フィルターのクリア

Need help writing a simple pseudo code for the following script

2 ビュー (過去 30 日間)
Samuel Walker
Samuel Walker 2021 年 3 月 21 日
コメント済み: John D'Errico 2021 年 3 月 21 日
dt = 0.1;
omega1 = 10;
domega_dt = 1/1000;
R = 0.11;
S = pi*R^2;
rho = 1.225;
m = 0.43;
t=0:dt:2;
u=zeros(length(t));
v=zeros(length(t));
x=zeros(length(t));
y=zeros(length(t));
u(1) = 25;
for i = 2:length(t)
omega = omega1 - domega_dt* t(i);
vspin = omega*R;
speed = sqrt(u(i-1)^2+v(i-1)^2);
CL = 1/(2+(speed/vspin));
CD = 0.55 + 1/(22.5 + 4.2*(speed/vspin)^2.5)^0.4;
Lift = 0.5*rho*S*speed^2*CL;
Drag = 0.5*rho*S*speed^2*CD;
u(i) = u(i-1) + (dt/m)*(-Drag * u(i-1) - Lift*v(i-1))/max(speed,1e-16);
v(i) = v(i-1) + (dt/m)*(-Drag * v(i-1) + Lift*u(i-1))/max(speed,1e-16);
x(i) = x(i-1) + dt*(u(i-1)+u(i))/2;
y(i) = y(i-1) + dt*(v(i-1)+v(i))/2;
end
  2 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 3 月 21 日
編集済み: Cris LaPierre 2021 年 3 月 21 日
Why do you need pseudo code if you already have the code?
Consider going through MATLAB Onramp. It will give you the basics you need to understand this code, and you can complete it while you wait for an answer.
John D'Errico
John D'Errico 2021 年 3 月 21 日
Start with the first line. Think out what it does, and then think bout what it does in context of what the overall code should be used for. After all, it is you who apparently needs to use this code. So you probably have some clue what it SHOULD do. But just a list of lines of undocumented code is often worth no more than something produced by a chimp pecking away at a typewriter.

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

回答 (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