Wind turbine model block, cp(lambda, beta) function syntax error
조회 수: 14 (최근 30일)
이전 댓글 표시
Hello, I am trying to run a wind turbine model block from simscape, and I am getting this error.
The expression: c1*(c2/u[2]-c3*u[3]-c4)*exp(-c5/u[2])+c6*u[1]
in 'Wind turbine model/cp(lambda,beta)/Fcn1'
has a syntax error
This formula is the generic equation to model cp(lmbda,beta), what am I doing wrong? Do I need to define the coefficients or is it a simple syntax error? I have attached pictures of the wind tubine block parameter
댓글 수: 1
답변 (2개)
Geetla Sindhu
2022년 11월 11일
Hello Giovanni,
I understand that you are getting syntax error using MATLAB function block in Simulink.
The cause of this error is the use of square brackets [ ] for indexing the input vector. Instead, you can try using the following syntax to solve the issue.
function y = fcn(u)
y = c1*(c2/u(2) – c3*u(3) – c4)*exp(-c5/u(2)) + c6*u(1);
end
Hope this resolves your issue.
Thank you.
댓글 수: 4
Sam Chak
2023년 3월 27일
The error clearly tells you that the math expression has a syntax error, which is a common error when programmer uses some characters incorrectly, or misses some punctuation marks.
In your case, you should use the hyphen-minus (-) an ASCII character, as if it is directly entered from the keyboard.
In short, use (-) instead of (–).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1337269/image.png)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!