Question solve(eqn)

27 ビュー (過去 30 日間)
Jothi
Jothi 2025 年 2 月 24 日
編集済み: Walter Roberson 2025 年 2 月 24 日
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

回答 (2 件)

Torsten
Torsten 2025 年 2 月 24 日
編集済み: Torsten 2025 年 2 月 24 日
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.
  1 件のコメント
Jothi
Jothi 2025 年 2 月 24 日
Ok, thanks for the answer !

サインインしてコメントする。


Walter Roberson
Walter Roberson 2025 年 2 月 24 日
編集済み: Walter Roberson 2025 年 2 月 24 日
syms a0 a1 a2 a3 a4 a5
v = [0 2 4 6 8 10]
v = 1×6
0 2 4 6 8 10
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
f = [0 2.9 14.8 39.6 74.3 119]
f = 1×6
0 2.9000 14.8000 39.6000 74.3000 119.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
f1 = a0 + a1*v(1) + a2*v(1)^2 + a3*v(1)^3 + a4*v(1)^4 + a5*v(1)^5 == f(1)
f1 = 
f2 = a0 + a1*v(2) + a2*v(2)^2 + a3*v(2)^3 + a4*v(2)^4 + a5*v(2)^5 == f(2)
f2 = 
f3 = a0 + a1*v(3) + a2*v(3)^2 + a3*v(3)^3 + a4*v(3)^4 + a5*v(3)^5 == f(3)
f3 = 
f4 = a0 + a1*v(4) + a2*v(4)^2 + a3*v(4)^3 + a4*v(4)^4 + a5*v(4)^5 == f(4)
f4 = 
f5 = a0 + a1*v(5) + a2*v(5)^2 + a3*v(5)^3 + a4*v(5)^4 + a5*v(5)^5 == f(5)
f5 = 
f6 = a0 + a1*v(6) + a2*v(6)^2 + a3*v(6)^3 + a4*v(6)^4 + a5*v(6)^5 == f(6)
f6 = 
sol = solve([f1, f2, f3, f4, f5, f6])
sol = struct with fields:
a0: 0 a1: 137/80 a2: -1147/960 a3: 127/192 a4: -269/3840 a5: 1/384
% 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)
f7 = 

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

タグ

製品


リリース

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by