How do I calculate the coefficients C in this function while P and T are given?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Zifeng Qiu
am 19 Jul. 2020
Beantwortet: Rafael Hernandez-Walls
am 19 Jul. 2020
T=[4:4:24]';
P=[1e-4;2.5e-4;6e-4;1e-3;1.6e-3;2.25e-3];
plot(T,P)
%find C with the given vectors
0 Kommentare
Akzeptierte Antwort
Rafael Hernandez-Walls
am 19 Jul. 2020
You can use this equations:
T=[4:4:24]';
P=[1e-4;2.5e-4;6e-4;1e-3;1.6e-3;2.25e-3];
plot(T,P,'o')
n=length(P);
A=[ones(n,1) T T.^2];
C=inv(A'*A)*A'*P;
P2=C(1)+C(2)*T+C(3)*T.^2;
hold on
plot(T,P2)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!