Getting joint lines in 2-D plot instead of a single line.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Vaishali
il 23 Dic 2023
Commentato: Sulaymon Eshkabilov
il 23 Dic 2023
I'm trying to plot a Force v/s Angle graph like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1575247/image.png)
But I'm getting joint lines like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1575252/image.png)
What am I doing wrong? Thank in advance for answering. Have a nice day :)
1 Commento
Risposta accettata
Sulaymon Eshkabilov
il 23 Dic 2023
Small correction is needed with the indexing, see this sample code:
X = [ 0 5 10 15 -3 -5];
Y = [2*X.^2+2; 3*X.^2+2; 2.5*X.^2+5;]
figure
subplot(211)
plot(X, Y, '-s')
title('Wrong')
Xs=sort(X);
subplot(212)
plot(Xs, Y, '-o')
title('Corrected')
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!