Expired coding question, don't refer to this

1 回表示 (過去 30 日間)
Charlotte LaGasse
Charlotte LaGasse 2024 年 3 月 4 日
編集済み: Charlotte LaGasse 2024 年 3 月 7 日
Hi,
This code is not valid, solution found a different way.
figure(1)
qdot=(-2500:1:250);
Tout=qdot./7.63358+2669.85./7.63358;
plot(qdot,Tout);
title('Tout vs qdot')
xlabel('qdot')
ylabel('Tout')
figure(2)
qout=(-2500:1:250);
Tout1=-((qout.*2.5.*10.^(-4))./(0.558.*0.02)-307.15);
plot(qout,Tout1);
title('Tout vs qout')
xlabel('qout')
ylabel('Tout')
syms qout qdot
eqn = Tout == Tout1;
solve (eqn,qdot,qout)

回答 (1 件)

Florian Bidaud
Florian Bidaud 2024 年 3 月 4 日
編集済み: Florian Bidaud 2024 年 3 月 4 日
You haven't defined Tout and Tout1 as equations but as numerical variables because qout and qdot are int arrays. You should first declare qout and qdot as syms before defining Tout and Tout1
syms qout qdot
Tout=qdot./7.63358+2669.85./7.63358;
Tout1=-((qout.*2.5.*10.^(-4))./(0.558.*0.02)-307.15);
eqn = Tout == Tout1;
s=solve (eqn,qdot,qout);
disp(s)
qdot: -16102921157410571293520415132337/49517601571415210995964968960 qout: 0
figure(1)
qdot=(-2500:1:250);
Tout=qdot./7.63358+2669.85./7.63358;
plot(qdot,Tout);
title('Tout vs qdot')
xlabel('qdot')
ylabel('Tout')
figure(2)
qout=(-2500:1:250);
Tout1=-((qout.*2.5.*10.^(-4))./(0.558.*0.02)-307.15);
plot(qout,Tout1);
title('Tout vs qout')
xlabel('qout')
ylabel('Tout')
  1 件のコメント
John D'Errico
John D'Errico 2024 年 3 月 4 日
編集済み: John D'Errico 2024 年 3 月 4 日
This answer is good as a start, but not complete I would suggest. I think it did not go far enough. It is also the case there is no single, unique solution.
syms qout qdot
Tout=qdot./7.63358+2669.85./7.63358;
Tout1=-((qout.*2.5.*10.^(-4))./(0.558.*0.02)-307.15);
I'll show the relation reduced to short digits to make it more readable.
vpa(Tout == Tout1,4)
ans = 
As you can see, there is a linear relation between the two unknowns qdot and qout. Choose ANY value for one of them, and the other is given directly by a linear equation, a straight line.
We could even have MATLAB return the functional relationship itself, thus
qdotsol = solve(Tout == Tout1,qdot)
qdotsol = 
As a simple functional relationship, we see the dependence between the two.
vpa(qdotsol,4)
ans = 
Choose any value for qout, and you can compute qdot directly. And that is what I think the answer from @Florian Bidaud should have pointed out. We can see the relationship in the plot below:
fplot(qdotsol,[-2500,250])
xlabel qout
ylabel qdot
grid on
So ANY point on the straight line plot is a solution that makes the pair of expressions Tout and Tout1 equal.

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

カテゴリ

Help Center および File ExchangeGeneral Physics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by