for loop as matlab function in simulink

1 回表示 (過去 30 日間)
vishnuvardhan naidu tanga
vishnuvardhan naidu tanga 2019 年 12 月 12 日
Hello is there any way to do for loop as a matlab function in simulink. my code is as follows:
P=zeros(1,n+1 );
P(1) = P_in ;
CR = (P_out/P_in)^(1/n);
for i = 2:n
P(i) = CR*P(i-1 );
P(i+1) = CR*P(i );
end
T=zeros(1,n);
for i = 1:n-1
T(i) = ((P(i+1)/P_in)*(T_in^(kappa/(kappa-1))))^((kappa-1)/kappa);
T(i+1) = ((P(i+1)/P(i))*(T(i)^(kappa/(kappa-1))))^((kappa-1)/kappa);
end
running=zeros(n,1);
for i=1:n
running(i)=((P(i+1)/P(i))^((kappa-1)/kappa));
end
W = (kappa*M)/(kappa-1)*((sum(running))-n);
is there any way to solve this in simulink?

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by