f1 = 
Question solve(eqn)
Show older comments
Hello, I'm wondering, how can we take the values of the different variables which where found by the function 'solve' and use them for another calculation ? I wrote this and i need the values of a0, a1, a2, a3, a4 and a5 for the calculation of f7.
syms a0 a1 a2 a3 a4 a5
v = [0 2 4 6 8 10]
f = [0 2.9 14.8 39.6 74.3 119]
f1 = a0 + a1*v(1) + a2*v(1)^2 + a3*v(1)^3 + a4*v(1)^4 + a5*v(1)^5 == 0
f2 = a0 + a1*v(2) + a2*v(2)^2 + a3*v(2)^3 + a4*v(2)^4 + a5*v(2)^5 == 2.9
f3 = a0 + a1*v(3) + a2*v(3)^2 + a3*v(3)^3 + a4*v(3)^4 + a5*v(3)^5 == 14.8
f4 = a0 + a1*v(4) + a2*v(4)^2 + a3*v(4)^3 + a4*v(4)^4 + a5*v(4)^5 == 39.6
f5 = a0 + a1*v(5) + a2*v(5)^2 + a3*v(5)^3 + a4*v(5)^4 + a5*v(5)^5 == 74.3
f6 = a0 + a1*v(6) + a2*v(6)^2 + a3*v(6)^3 + a4*v(6)^4 + a5*v(6)^5 == 119
solve (f1, f2, f3, f4, f5, f6)
% Lorsque le projectile se déplace à la vitesse de 750 ft/sec, la force de
% ce même projectile est :
v(7) = 750;
% Calcul de la force
f7 = a0 + a1*v(7) + a2*v(7)^2 + a3*v(7)^3 + a4*v(7)^4 + a5*v(7)^5
Answers (2)
Replace
solve (f1, f2, f3, f4, f5, f6)
by
[a0,a1,a2,a3,a4,a5] = solve (f1, f2, f3, f4, f5, f6)
But note that extrapolating the function from the interval [0 10] for v to v = 750 is doubtful.
Walter Roberson
on 24 Feb 2025
Edited: Walter Roberson
on 24 Feb 2025
syms a0 a1 a2 a3 a4 a5
v = [0 2 4 6 8 10]
f = [0 2.9 14.8 39.6 74.3 119]
f1 = a0 + a1*v(1) + a2*v(1)^2 + a3*v(1)^3 + a4*v(1)^4 + a5*v(1)^5 == f(1)
f2 = a0 + a1*v(2) + a2*v(2)^2 + a3*v(2)^3 + a4*v(2)^4 + a5*v(2)^5 == f(2)
f3 = a0 + a1*v(3) + a2*v(3)^2 + a3*v(3)^3 + a4*v(3)^4 + a5*v(3)^5 == f(3)
f4 = a0 + a1*v(4) + a2*v(4)^2 + a3*v(4)^3 + a4*v(4)^4 + a5*v(4)^5 == f(4)
f5 = a0 + a1*v(5) + a2*v(5)^2 + a3*v(5)^3 + a4*v(5)^4 + a5*v(5)^5 == f(5)
f6 = a0 + a1*v(6) + a2*v(6)^2 + a3*v(6)^3 + a4*v(6)^4 + a5*v(6)^5 == f(6)
sol = solve([f1, f2, f3, f4, f5, f6])
% Lorsque le projectile se déplace à la vitesse de 750 ft/sec, la force de
% ce même projectile est :
v(7) = 750;
% Calcul de la force
f7 = subs(a0 + a1*v(7) + a2*v(7)^2 + a3*v(7)^3 + a4*v(7)^4 + a5*v(7)^5, sol)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!