I keep getting an error message for my subplot syntax? Could anyone out there look over my script, and tell me whats wrong?
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Carlyle Hickman
am 26 Okt. 2016
Kommentiert: Chaya N
am 26 Okt. 2016
%subplot.m x = 0:0.1:5; y = exp(-1.2*x).*sin(10*x+5); subplot(1,2,1) plot(x,y),xlabel('x'), ylabel('y'),axis([0 5 -1 11]) x = -6:0.1:6; y = abs(x.^3-100); subplot(1,2,2) plot(x,y),xlabel ('x'),ylabel('y'),axis([-6 6 0 350])
3 Kommentare
Chaya N
am 26 Okt. 2016
Right! Please change the name of the script to something else so it doesn't override the inbuilt function and you're good to go.
Akzeptierte Antwort
Chaya N
am 26 Okt. 2016
This is simply a reformatted version. Please try running this:
x = 0:0.1:5;
y = exp(-1.2*x).*sin(10*x+5);
subplot(1,2,1), plot(x,y);
xlabel('x'), ylabel('y'),axis([0 5 -1 11]);
x = -6:0.1:6;
y = abs(x.^3-100);
subplot(1,2,2), plot(x,y);
xlabel ('x'),ylabel('y'),axis([-6 6 0 350]);
Weitere Antworten (1)
Changoleon
am 26 Okt. 2016
Hey, try putting semicolon (;) between your commands instead of comma (,)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!