Problem with a function

1 回表示 (過去 30 日間)
Paul Rogers
Paul Rogers 2020 年 10 月 21 日
コメント済み: Paul Rogers 2020 年 10 月 24 日
Hello everyone, I wrote this function:
function dz = nocontrol(v,z,parameters)
phi_0 =0.6;
psi_0 =0.6857;
psi_c0 = 0.3;
Lc = 3; %m
W = 0.25;
H = 0.18;
C = 0;
dz = zeros(2,1);
dz(2) =(1/Lc)*(psi_c-z(1));
my problem is that I don't know how to write properly gammaT. I'd like to express it as a function, something like this:
gammaT_max = 0.8;
gammaT_min = 0.7;
A = (gammaT_max - gammaT_min)/2; %amplitude
b = gammaT_max - ((gammaT_max - gammaT_min)/2);
gammaT = A*sin(w*t)+b
but I don't know how.
  2 件のコメント
Paul Rogers
Paul Rogers 2020 年 10 月 21 日
編集済み: Paul Rogers 2020 年 10 月 21 日
I'd like to define gammaT as a function of the time, but I don't knwo how.



Walter Roberson
Walter Roberson 2020 年 10 月 21 日
You have defined gammaT as a variable that you multiply by, but it needs to be a function of time. You will likely need something like
gammaT = @(t) A*sin(w*t)+b
The SOMETHING would have to be replaced with your time variable, but it is not obvious that you have a time variable. Perhaps v is your time variable.
  3 件のコメント
Paul Rogers
Paul Rogers 2020 年 10 月 24 日
thanks a lot, you really solved me something I couldn't figured out.
just the argument in the sin was't W but another variable w in radians.
It woorks now


その他の回答 (0 件)




Community Treasure Hunt

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

Start Hunting!

Translated by