Subscript indices error when not running a loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Vidhan Malik
am 15 Apr. 2016
Kommentiert: Vidhan Malik
am 16 Apr. 2016
Running this code and I don't have any loops or matrices so am really confused why I am getting the error
"Subscript indices must either be real positive integers or logicals."
I tried debugging it to see if the error might be occurring due to the vpa solve function since there are actually two roots but I am only using the positive answer. So I replaced that line with R=1 and that error still remains.
clear; clc;
syms R
To7 = 1200;
To6 = 1800;
Ya = 1.4/0.4;
Ym = 1.35/0.35;
Yc = 1.3/0.3;
Rg = 0.287;
Qr = 45e3;
T32 = 276;
PrT = (To7/To6)^(Yc/0.92); %Step 1
PrC = 1/(0.97*0.99^3*PrT*0.975*0.98); %Step 2
To4 = 276*PrC^(1/(0.9*Ym)); %Step 3
To5 = 0.92*(To7 - To4) + To4; %Step 4
fostoic = 14/(1.5*(32+3.76*28));
fo = 0.9*fostoic; %Step 5
E = (1+R)*(Ym*Rg)*To5 + fo/(1+R)*Qr == (1+R+fo/(1+R) - 0.12*(1+R))*Yc*Rg*To6;
R = vpasolve(E,R,[0 Inf]); %Step 6
Wnet = (1+R+fo/(1+R) - 0.12*(1+R))*Yc*Rg*(To6-To7) - (1+R)*Ym*Rg(To4-T32);
disp(Rg);
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Function Creation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!