variable is not recognized from other function
Show older comments
Unrecognized function or variable 'Mi'.
Error in FourStrokeCycle (line 40)
Mbar=Mi*nin(1)/nin
function [pa,Ta,sa,cpi,Mi,nin] = AirProperties()
AirMatrix= readmatrix('AirProperties.xlsx');
pa=101325
Ta=273
sa=3796
cpi= AirMatrix(3,:)
Mi= AirMatrix(2,:)
nin= AirMatrix(1,:)
end
function [therm,chem,r_c,mfuel,mC02,ddt] = FourStrokeCycle(D,d,rpm,fuel,N)
fuel=0;
fuel= FuelProperties(fuel);
airprop= AirProperties();
%test inputs
rpm=1500
d=.02
N=6
V0=0.00006
L=0.1
D=0.02
PhiI=pi/6
PhiE=pi/6
omega= rpm* 0.10472
% convert rpm to omega rad/s
k=[1:1:N+1]
PhiK=(k-1)*(4*pi)/N
tK=(k-1)*(4*pi)/(N*omega)
PhiT= omega.*tK
x=(D/2)*cos(PhiT)+sqrt(((4*L^2)/D^2)-sin(PhiT).^2)
Vt= V0+(pi.*d^2)./4.*(L+(D./2)-x)
r_c= (V0+D*(pi*d^2)/4)/V0
therm = zeros(8,N+1)
P=zeros(1,N+1)
T=zeros(1,N+1)
P(1)=101325
Ru=8.3145
Mbar=Mi*nin(1)/nin
1 Comment
Stephen23
on 3 May 2023
How to call functions with multiple outputs is explained ihere:
Accepted Answer
More Answers (0)
Categories
Find more on Programming 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!