The "plot" and "polyfit".
Mostra commenti meno recenti
I want to plot a graph of a function fitted by two list of t and fp. A dependent variable fp is gotten by a independent variable t with a fitting function using "ployfit". I don't know how to plot a graph of the function ,even if I got "fp"s from "t" given arbitrarily.The code is shown below.
function y=fp(t)
t_1=[0 0.15 0.49 2.1126];
t_2=[2.27 3.53 8.78 25.45 42.80 43.68 44.08];
p_1=9.80665*[331.2 614.3 505.4 607.8];
p_2=9.80665*[48.65 43.97 42.01 41 40.8 40.79 2.22];
y=polyfit(t_2,p_2,2)*[t.*t;t;1]*(t>=2.1126)+polyfit(t_1,p_1,2)*[t.*t;t;1]*(t>=0&&t<2.1126);
end
Actually,the "plot" seems workable, but I need help to plot;
1 Commento
John D'Errico
il 25 Mag 2015
Please learn to format your code so it will be readable. I've done that for you this time.
You do realize that this is not actually a spline that you are building? It is not even a continuous function across the breakpoint.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Spline Postprocessing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
