If I want to make a piecewise function where lets say $f(x) = x^2 +1$ at $1 \leq t \leq 2$ and zero elsewhere. How can I make this possible using an anonymous function? I wanted to invent y = @(t) ((t.^2 + 1)*(t>=1)&&(t<=2))
But that obviously did not work out at all.
Thanks
y_b =@(t2) -3.0*x2(t2-2); subplot(1,2,2) plot(t2,y_b(t2)) xlabel('t2') ylabel('y_b(t2)') axis([1.5 3 -2 1])
– user1945925 Jan 22 '13 at 13:40x2(t2-2)which is all zero – Dennis Jaheruddin Jan 22 '13 at 13:48