Save output data in a vector format while loop
显示 更早的评论
Hi all,
I would like to export the output of the while loop in a vector format but it is not working for me... below is the code please advise.
Thanks
function [Q,h,t,v]= func (h0,D,d,dt)
g=9.81;
rho=1000;
h=h0;
t=0;
j=0;
% v=sqrt(2*g*h)
% h=(sqrt(h0)-1/2*d^2/D^2*sqrt(2*g)*t)^2
% Q=sqrt(2*g*h)*pi*d^2/2
while (t<228)
j=j+1;
t=t+dt;
h=((sqrt(h0))-((1/2)*(d^2)/(D^2)*(sqrt(2*g))*t))^2;
v=sqrt(2*g*h);
Q=sqrt(2*g*h)*pi*(d/2)^2;
a(j)=Q;
b(j)=h;
c(j)=t;
d(j)=v;
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!