Is there a command to match isolated points on graph by a curve, not straight lines?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Daniel
am 25 Okt. 2014
Kommentiert: Star Strider
am 25 Okt. 2014
teta=[0.25,0.5,0.75,1,1.25]
eta100=100-1/1*(1.5./teta+teta*2.2)
plot(teta, eta100,'k','LineWidth',2) %some line specification for curved plot?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 25 Okt. 2014
Bearbeitet: Star Strider
am 25 Okt. 2014
Something like this?
Example using 'spline' interpolation:
teta=[0.25,0.5,0.75,1,1.25]
eta100=100-1/1*(1.5./teta+teta*2.2)
tetai = linspace(min(teta), max(teta)); % Create Interpolation Points
eta100i = interp1(teta, eta100, tetai,'spline'); % Use 'spline' Interpolation
plot(tetai, eta100i,'k','LineWidth',2) %some line specification for curved plot?
hold on
plot(teta,eta100,'*r')
hold off
legend('Interpolated Line','Data', 'Location','SE')
EDIT — Added plot:
2 Kommentare
Star Strider
am 25 Okt. 2014
My pleasure!
That’s about as efficient as it gets in MATLAB. Defining the interpolation vector (here ‘tetai’) and then doing the interpolation and plotting it is necessary. It is certainly possible to write a function to do what you want, essentially incorporating all the steps I did here, depending on what you want it to do. That would do everything in one command. We can work on that if you like.
Back in a few minutes. Windows decided to force me to update to Win 8.1 (from 8) this morning, so I’m still working on reinstalling the drivers. One is demanding a reboot just now.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!