Afficher commentaires plus anciens
下面这个代码是用来绘图的,绘的是sin(x),sin(2x),sin(3x);我目前有个问题就是,这个程序是我在书上copy下来的,但是matlab始终报错,
x1=0:0.02*pi:2*pi;
y1=[sin(x1);sin(2*x1);sin(3*x1);];
figure1=figure('PaperPositon',[0.6345 6.345 20.3 15.23],'PaperSize',[20.98 29.68]);
axes1 = axes('Parent',figure1);
axis(axes1,[0 6.283 -2 2]);
title(axes1,'sin(x)/sin(2x)/sin(3x)');
xlabel(axes1,'x');
ylabel(axes1,'y');
box(axes1,'on');
hold(axes1,'all');
plot1 = plot(x1,y1);
text1 = text('Position',[1.136 -0.9532 0],'String','y=sin(x)','VerticalAlignment','baseline','Parent',axes1)';
text2 = text('Position',[2.266 -0.8947 0],'String','y=sin(2x)','VerticalAlignment','baseline','Parent',axes1)';
text3 = text('Position',[3.395 -0.8947 0],'String','y=sin(3x)','VerticalAlignment','baseline','Parent',axes1)';

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 图形对象 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!