Error using Cos, not enough input arguments
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Ned Sara
el 5 de Abr. de 2019
Comentada: Stephen23
el 5 de Abr. de 2019
Hello, I'm having a problem with the cosine and sine functions in MatLab. I'm trying to replicate the effect of a plasma actuator in matlab which involves adding a source term that replicates the effect. The source term involve a Guassian function;
a = (cos^2*(pi/2)/2*Ox^2) + (sin^2*(pi/2)/2*Oy^2);
b = (-(sin*2*(pi/2)/4*Ox^2 + (sin*2*(pi/2)/4*Oy^2)));
c = (sin^2*(pi/2)/2*Ox^2) + (cos^2*(pi/2)/2*Oy^2);
with the source term being;
Su = A*exp(-(a(x-xc)^2 + 2*b(x-xc)*(y-yc) + x(y-yc)^2));
when i try running, it says error using cos, not enough input arguments. Does anyone know where im going wrong?
Thanks
0 comentarios
Respuesta aceptada
Stephen23
el 5 de Abr. de 2019
Editada: Stephen23
el 5 de Abr. de 2019
cos^2*(pi/2) % incorrect
cos(pi/2)^2 % correct
Your code has several other syntax errors, such as:
Ox % what does this mean?
Oy % what does this mean?
and
b(...) % if this is supposed to be multiplication, then you actually need:
b*(...)
You should learn basic MATLAB concepts by doing the introdcutory tutorials:
and also reading the documentation for every operation that you use, no matter how trivial you think it might be. You should also learn about vectorized code:
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Axis Labels en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!