Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- X/25, 0 <= x <= 5
- 2/5-x/25, 5 <= x <= 10
- 0, otherwise
- function [y] = f( x )
- if (x>=0 && x<=5)
- y = x/25;
- elseif (x>=5 && x<=10)
- y =2/5-x/25;
- else
- y=0;
- end
- end
- function [y] = f( x )
- n = numel(x);
- y = zeros(1,n);
- for k = 1:n
- if (x(k)>=0 && x(k)<=5)
- y(k) = x(k)/25;
- elseif (x(k)>=5 && x(k)<=10)
- y(k) =2/5-x(k)/25;
- else
- y(k)=0;
- end
- end
- x = 0:0.1:15;
- y = f(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement