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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Judith Orinda
am 20 Jul. 2020
Kommentiert: Judith Orinda
am 20 Jul. 2020
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
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 20 Jul. 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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!