Hello everyone, I wrote this function:
function dz = nocontrol(v,z,parameters)
gammaT=??????????;
phi_0 =0.6;
psi_0 =0.6857;
psi_c0 = 0.3;
B=1.8;
Lc = 3; %m
W = 0.25;
H = 0.18;
C = 0;
dz = zeros(2,1);
dz(1)=(1/(4*B*B*Lc))*(z(2)-gammaT*(z(1))^0.5);
psi_c=psi_c0+H*(1+1.5*(z(2)/W-1)-0.5*(z(2)/W-1).^3);
dz(2) =(1/Lc)*(psi_c-z(1));
end
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 comentarios

madhan ravi
madhan ravi el 21 de Oct. de 2020
what's your question? Are you asking if the way you defined the gamma function is correct?
Paul Rogers
Paul Rogers el 21 de Oct. de 2020
Editada: Paul Rogers el 21 de Oct. de 2020
I'd like to define gammaT as a function of the time, but I don't knwo how.

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Oct. de 2020

1 voto

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
dz(1)=(1/(4*B*B*Lc))*(z(2)-gammaT(SOMETHING)*(z(1))^0.5);
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 comentarios

Paul Rogers
Paul Rogers el 21 de Oct. de 2020
Editada: Paul Rogers el 21 de Oct. de 2020
thank you, I'll give you alll the filles i am using to call this function.
1- run compressor2_data.m
2 - run general that calls the function nocontrol.m
when I wrote:
A*sin(w*t)+b
i mean that t is time
Walter Roberson
Walter Roberson el 22 de Oct. de 2020
You do not have a time variable, so I had to substitute the closest I could find.
function dz = nocontrol(v,z,parameters)
gammaT=parameters(1);
phi_0=parameters(2);
psi_0=parameters(3);
psi_c0=parameters(4);
B=parameters(5);
Lc=parameters(6);
W=parameters(7);
H=parameters(8);
C = 0;
gammaT_max = 0.8;
gammaT_min = 0.7;
A = (gammaT_max - gammaT_min)/2; %amplitude
b = gammaT_max - ((gammaT_max - gammaT_min)/2);
gammaT = @(t) A*sin(W*t)+b
dz = zeros(2,1);
dz(1)=(1/(4*B*B*Lc))*(z(2)-gammaT(v)*(z(1))^0.5);
psi_c=psi_c0+H*(1+1.5*(z(2)/W-1)-0.5*(z(2)/W-1).^3);
dz(2) =(1/Lc)*(psi_c-z(1));
end
Paul Rogers
Paul Rogers el 24 de Oct. de 2020
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Productos

Versión

R2014b

Preguntada:

el 21 de Oct. de 2020

Comentada:

el 24 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by