How can I get the return of a constructed function as an array?
Ältere Kommentare anzeigen
The constructed function is
function [a] = triangle(n)
a=zeros(size(n));
if (n>=0 & n<=pi) % use an if else statement to execuete
a = pi-n;
else
a = 0; %n; % 0 otherwise
end
end
It can be used with integral function very well. But when I input x = -3:0.01:3, the return velue is 0.
>> x = -3:0.01:3;
>> triangle(x)
ans =
0
>>
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!