フィルターのクリア

How to express a function both time and spatial dimension dependent?

2 ビュー (過去 30 日間)
Meva
Meva 2014 年 1 月 27 日
コメント済み: Amit 2014 年 1 月 27 日
Hi there,
It seems an easy one but I guess it is not that easy. I have a fluid flowing through a vessel. I want to measure its velocity u1 and u2. the vessel coordinetes from the lateral position x=0 to x=1 in time from t=0 to t=3. The code is :
ii=101;
dt=0.1;
t = 0:dt:10;
dx=0.01; %step size
fik=0.4;
for i=1:ii;
x=(i-1)*dx;
H1D=0.1;
H1=0;
A=0;
AD=0.1;
fikness=fik*sin(pi*x);
ub1(i)=(c1b-H1D*(x-0.5)+AD/2*(x-0.5)^2)/(H1-0.5*fikness-A*(x-0.5));
ub2(i)=(c2b+H1D*(x-0.5)-AD/2*(x-0.5)^2)/(1-H1+0.5*fikness+A*(x-0.5));
end
H1D=H1D+dt*H1DDOT %------lets say these H1D, H1DDOT, H1 are time dependent functions.
H1=H1+dt*H1
AD=AD+dt*ADDOT;
A=A+dt*AD
Matlab runs the program above but it is not showing time. For example if I want to see in time t=2 what are the velocities u1 and u2 over the whole vessel (from x=0 to x=1)? How can I plot and see the results Thanks in advance

回答 (1 件)

Amit
Amit 2014 年 1 月 27 日
Well, your time is stored in vector t. So lets say you want to plot ub1 versus time, it will be:
plot(t,ub1);
  3 件のコメント
Meva
Meva 2014 年 1 月 27 日
plot (t,ub1) is not what I want since x axes must be x(lateral position) y axes must be ub1 and ub2 at a special time say t=1 or t=2. I mean we want to see the velocities versus x (lateral position) at time 1st second or 2nd second like that. Thanks a lot.
Amit
Amit 2014 年 1 月 27 日
Like I said, you have done your calculation for the first time step only. You need to go through more time loops.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by