I am trying to use the matlab function on my simulink model to model Voltage that is a function of vibration from my piezoelectric source. I wrote the code below but the code analyzer doesnt seem to read the function call line. How do I fix this?

2 vues (au cours des 30 derniers jours)
function Vpiezo=fcn(vib)
w=12;
b=1;
h=0.4;
e31=11.2;
e33=(8.85*10^(-12))*1800;
delta=0.1;
L=5;
R=delta/(b*L*e33*w);
Vpiezo=(w*b*h*e31*R*vib)/(2(1+(b*L*e33*((w*R)/delta))));
end

Réponse acceptée

Walter Roberson
Walter Roberson le 20 Juil 2020
Vpiezo=(w*b*h*e31*R*vib)/(2(1+(b*L*e33*((w*R)/delta))));
^^
In MATLAB, the syntax 2(something) is an attempt to index the constant 2 with the content of the expression. This is not permitted sytax in MATLAB.
Note; MATLAB has absolutely no implied multiplication. If you want multiplication in MATLAB, you must always use the .* or * operation as appropriate to the circumstances.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by