output argument not assigned during call
Show older comments
this is part of the code but i get an error that " output argument J not assigned during call" can anyone help me see where im messing up
K = linspace(-20.5,13,501);
UpperBound = 1;
LowerBound = 0;
J = MYFunction(K)
function J = MYFunction(x)
N = length(x);
for n = 1:N
if x(n) <= -5.5
y(n) = .2.*x(n) + 4.1;
end
if (x(n) > -5.5 & x(n) <= 5.5)
y(n) = .08.*x(n).^2 + 5.42;
end
if x(n) > 5.5
y(n) = -.4.*x(n) + 5.2;
end
end
Accepted Answer
More Answers (1)
Steven Lord
on 30 Jun 2020
0 votes
Where in your MYFunction function do you assign any value to the variable J?
2 Comments
Robert Tapia
on 30 Jun 2020
Prateek Tiwari
on 30 Jun 2020
Hi @ Steven
Can you please help me with this,
https://nl.mathworks.com/matlabcentral/answers/557005-calling-a-function-in-matlab-function-block-in-simulink?s_tid=prof_contriblnk
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!