Expired coding question, don't refer to this

조회 수: 2 (최근 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 CenterFile Exchange에서 General Physics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by