问一下大家为啥出错了,是哪一步出了问题吗。
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
皇家国际在线开户【微8785092】
le 18 Mai 2023
Réponse apportée : 皇家国际注册开户【微8785092】
le 18 Mai 2023
>> x=-pi:pi/100:pi;
y1=cos(1.*(1./cos(x)));
y2=cos(2.*(1./cos(x)));
y3=cos(3.*(1./cos(x)));
y4=cos(4.*(1./cos(x)));
y5=cos(5.*(1./cos(x)));
plot(x,y1,x,y2,x,y3,x,y4,x,y5);
legend('m=1','m=2','m=3','m=4','m=5');
title('Chebyshev');
xlabel('X'),ylabel('Y');
>> grid;
>> x=linspace(-1,1);
>> y=[];
>> for m=1:5
y=[y,cos(m*acos(x))];
end
>> plot(x,y);
Error using plot
Vectors must be the same lengths.
>> legend('m=1','m=2','m=3','m=4','m=5')
>>
0 commentaires
Réponse acceptée
皇家国际注册开户【微8785092】
le 18 Mai 2023
仅供参考
x=-pi:pi/100:pi;
y1=cos(1.*(1./cos(x)));
y2=cos(2.*(1./cos(x)));
y3=cos(3.*(1./cos(x)));
y4=cos(4.*(1./cos(x)));
y5=cos(5.*(1./cos(x)));
plot(x,y1,x,y2,x,y3,x,y4,x,y5);
legend('m=1','m=2','m=3','m=4','m=5');
title('Chebyshev');
xlabel('X'),ylabel('Y');
grid;
x=linspace(-1,1);
for m=1:5
y(m,:)=cos(m*acos(x));
end
plot(x,y);
legend('m=1','m=2','m=3','m=4','m=5')
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!