![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178272/image.png)
How to make a plot smooth
26 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kutru biladi
el 3 de Sept. de 2015
i have a plot. Now i want to make it smooth using interpolation. How shoud i do it? Moreover, the peak should be at same point.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148728/image.jpeg)
figure,plot(f,2*abs(res));
xlabel('frequency(GHz)'); ylabel('standarddev(%)');
grid
0 comentarios
Respuesta aceptada
Stephen23
el 3 de Sept. de 2015
Editada: Stephen23
el 3 de Sept. de 2015
It sounds like you want a kind of interpolation, because "smoothing" usually trims the values of the extreme points of a curve, whereas interpolation fits those points exactly (as per your requirement that "the peak should be at same point").
Because I do not have your data here is a simple example using pchip.There are other 1D interpolation functions to choose from, so you should take a look and pick one that best suits your needs.
>> Y = [1,1,2,1,1];
>> X = [0,1,3,4,5];
>> Xi = 0:0.1:5;
>> Yi = pchip(X,Y,Xi);
>> plot(Xi,Yi,X,Y)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178272/image.png)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!