Multiple inputs/outputs of a function
古いコメントを表示
I have my function defined as:
function [x,y] = get_y(x)
if x<-1;
y=exp(x+1);
else
if (-1<x & x<5);
y=2+cos(pi*x);
else x>=5;
y=10*(x-5)+1;
end
end
end
when I individually run x=-2 or x=8, I get the correct answer.
When i run x=[-2,8], it only gives me answers based on the 3rd parameter. How do I get the correct output parameterized by the input?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!