matlab改变参数的不同图像上连接特殊点的再画图

如图所示,想在改变r1参数取值的情况下连接每条曲线的极值点,要怎么写命令呀?谢谢大家!

img

你好,首先是极值点怎么获取,比方说

x = linspace(0,40*pi,10000);
y = x.^2.*sin(x);
plot(x,y,'b')
hold on
[~,locs] = findpeaks(y);
plot(x(locs), y(locs), 'r-o', 'markerfacecolor', 'r')

img