Calculating efficiency using matlab

9 visualizzazioni (ultimi 30 giorni)
kasim
kasim il 2 Apr 2020
Commentato: Star Strider il 2 Apr 2020
Hi, I am trying to calculate the efficiency which I would then like to plot against I as shown below. However the following code doesn't output the correct result. I.e. for the first value of Tout & I - the calculation for efficiency (n) should be: (0.02*1009*(323.2-295)/(500*1.8)) x 100 = 63.2%
For some reason in the code the answer is 94%. Could anyone provide some suggestions
Kind regards
for Tout = [323.2 326.0 328.8 331.6 334.3 337.1];
I = [500 550 600 650 700 750];
m = 0.02;
cp = 1009;
Tin = 295;
A = 1.8;
n = m*cp*(Tout - Tin)./A*I
plot(I,n)
end

Risposta accettata

Star Strider
Star Strider il 2 Apr 2020
No loops needed:
Tout = [323.2 326.0 328.8 331.6 334.3 337.1];
I = [500 550 600 650 700 750];
[Toutm,Im] = ndgrid(Tout,I); % Create Matrices From Vectors
m = 0.02;
cp = 1009;
Tin = 295;
A = 1.8;
n = m*cp*(Toutm - Tin)./A*Im; % Calculate Using Matrices
figure
plot(I,n) % Plot Matrix ‘n’ As Function Of ‘I’
grid
ylim([min(ylim) 2.5E+6])
xlabel('I')
ylabel('n')
legend(sprintfc('T_{out} = %.1f', Tout), 'Location','NW')
Make appropriate changes to get the result you want.
  2 Commenti
kasim
kasim il 2 Apr 2020
Hi, I have attached two pictures.
The first is the graph that is produced from the matlab script and the other is ideally what I am trying to get matlab to produce. Again, thank you for your help!
Regards
Star Strider
Star Strider il 2 Apr 2020
My pleasure.
The only other approach I can think of is:
n = m*cp*(Tout - Tin)./A.*I;
figure
plot(Tout, n)
grid
Note the element-wise multiplication in the ‘n’ calculation.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by