How to make plot smooth when we can not increase the x and y variables.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Najam us Saqib Fraz
il 28 Ott 2020
Risposto: Mayank Bajpai
il 28 Ott 2020
Hello Every One.....
I am plotting a graph between two values let say x and y. There 10 x's and 10 y's.So when I plot I get a straight line plot,which looks very ugly.Please look at the pic given.Remember number of x and y are fixed,becuse I am getting this from the answer of a series of operation applied in loop.I can not increase the numb of x and y.Is there any way I can do this ?? Thanks![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/395578/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/395578/image.jpeg)
0 Commenti
Risposta accettata
Mayank Bajpai
il 28 Ott 2020
Instead of linear interpolation in the plot, try a spline interpolation?
xx=linspace(min(x),max(x),50);
yy=interp1(x,y,xx,'spline'); % spline interpolation
plot(xx,yy,'r-') % to show the interpolated plot
scatter(x,y,'ro',filled) % to show the observed data points
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Smoothing 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!