i need to find matlab code for following flow chart
1 view (last 30 days)
Show older comments
Ap=(pi/4)*(0.0032^2);
As=(pi/4)*(0.010^2);
Am=(pi/4)*(0.020^2);
Ad=(pi/4)*(25.088^2);
H1=280.5;
P1=2250;
Hp=279;
vp=0.0009640;
mp=(Ap*(2*0.95*(H1-Hp))^0.5)/vp;
Vp=(2*0.95*(H1-Hp))^0.5;
H2=[250.9;251.4;251.9;252.4;252.9;253.8;254.7;255.6;256.0;256.5];
Hs=[250;251;251;252;252.2;253;254;255;255.8;256];
p3=[675;700;725;737.5;750;775;800;825;850;875;900];
pm=[675;700;725;737.5;750;775;800;825;850;875;900];
vm=[0.0008299;0.0008332;0.0008364;0.0008379;0.0008395;0.0008427;0.0008459;0.0008489;0.0008520;0.0008550;0.0008581];
Tol=1e-4;
r=1:10;
DiffError=DiffError(r);
sumError=sumError(r);
for r=1:10
for i=1:length(H2)
for j=1:length(Hs)
for k=1:length(p3)
for t=1:length(pm)
for n=1:length(vm)
ms=(As*(2*0.95*(H2(i)-Hs(j)))^0.5)/((2*0.95*(H2(i)-Hs(j)))^0.5);
Vs=(2*0.95*(H2(i)-Hs(j)))^0.5;
mm=mm(r);
mm(r)=mp+ms;
Vm=mp/Am;
muo=(ms/mp);
Vp=mp/Ap;
Vbs=((Vp+muo*Vs)/((muo+1)*(1+(0.03*80)/(2*20))))+(((p3(k)+pm(t))*Am)/((1+(0.03*80))*mm));
Hbs=((Hp+((vp^2)/2)+muo*(Hs(j)+((Vs^2)/2)))/(1+muo))-((Vm^2)/2);
mmm=mmm(r);
mmm(r)=(Vm*Am)/vm(n);
DiffError=sum(((mm-mmm)^2/5)^0.5,'omitnan');
sumError=sum((mm-mmm)^2,'omitnan');
[sumError,DiffError]=check(H2,Hs,p3,pm,vm,ms,Vs,mm,muo,Vp,mmm);
TotalErr=sumError^2+DiffError^2;
%TotalErr=[];
end
end
end
end
end
[a,b]=find(TotalError == min(min(TotalError)));
mm_iterative=mm(a(1));
mmm_iterative=mmm(b(1));
if min(min(TotalError))>= Tol
mm=[linspace(mm_iterative/10,mm_iterative,100),linspace(mm_iterative,mm_iterative*10,100)];
mmm=[linspace(mmm_iterative/10,mmm_iterative,100),linspace(mmm_iterative,mmm_iterative*10,100)];
TotalErr=[];
end
break
end
fprintf('mmm=%3u','mm=%3u',mmm,mm)
3 Comments
Walter Roberson
on 26 May 2022
What error message are you getting?
What relationship is there between the code and the flow chart? The two appear to be completely unrelated.
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!