Info

This question is closed. Reopen it to edit or answer.

I am trying to plot a function based on different x-axis values. The code is displayed in the body below. The error displayed by the compiler is also shown below the code.

1 view (last 30 days)
code :
" function P = volt_ind_cell(U)
%#codegen
P = zeros(19172, 12);
a := 0:
b := 0:
for a from 1 to 19172 step 1 do
for b from 1 to 12 step 1 do
if U(a,b) < 3.5 then
P(a,b) = 2.48 * [(U-3) * (U-3)];
else
P(a,b) = 0.877 * [(sqrt(U-3))];
end
end
end "
error :
"Unexpected MATLAB expression.
Function 'MATLAB Function' (#47.86.87), line 8, column 7: "f" Launch diagnostic report. Component: MATLAB Function | Category: Coder error"
Apparently the error is in the first line wherein 'for a' loop has been declared.
Please let me know the reason for this failure. Thanks

Answers (0)

Community Treasure Hunt

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

Start Hunting!