Clear Filters
Clear Filters

Expired coding question, don't refer to this

2 views (last 30 days)
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)

Answers (1)

Florian Bidaud
Florian Bidaud on 4 Mar 2024
Edited: Florian Bidaud on 4 Mar 2024
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 Comment
John D'Errico
John D'Errico on 4 Mar 2024
Edited: John D'Errico on 4 Mar 2024
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.

Sign in to comment.

Categories

Find more on Line Plots 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!