Matlab的离散点曲线导数曲率数值模拟方法
clc; clear all; close all;x0 = linspace(0, 1);y0 = sin(x0).*cos(x0);h = abs(diff([x0(2), x0(1)]));% 模拟一阶导figure; box on; hold on;ythe1 = cos(x0).^2 - sin(x0).^2; %理论一阶导yapp1 = gradient(y0, h); %matlab数值近似plot(x0, ythe1, '.');plot(x0, yapp1, 'r');