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 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2020-7-20
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by