Borrar filtros
Borrar filtros

Code wont work keeps giving error message: Argument to dynamic structure reference must evaluate to a valid field name.

1 visualización (últimos 30 días)
this is my code:
t=0:0.001:10; wn= 0.898; a= 0.843; z= 0.005122; wd=0.897;
y= a*(exp.(-z*wn*t))*(sin(wd*t)) and I keep getting the same error message can someone help please thanks

Respuestas (2)

Jan
Jan el 30 de Sept. de 2017
Editada: Jan el 30 de Sept. de 2017
In "exp.(-z*wn*t)" the term "exp" is treated as a struct and "(-z*wn*t)" as a field name. "S.(name)" is a reference by a dynamic field name, when S is a struct and name a string.
Most likely you want:
y = a * exp(-z * wn * t) * sin(wd * t);

Star Strider
Star Strider el 30 de Sept. de 2017
Put the ‘dot operator’ here instead:
y = a*(exp(-z*wn*t)) .* (sin(wd*t))
That will do the element-wise multiplication you intend.

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by