This is a portion of my code:-
t = -4 : 0.01 :4;
f = inline('(-1.5*t+1) .* ((t>-3)&(t<0)) + (1.5*t+1) .* ((t>0)&(t<3))');
plot(t, f(t), 'r','linewidth', 2);
grid on;
Here I am getting the value of f(0) = 0
>> f(0)
ans =
0
I want to plot the function with f(0) = 3
For that I tried this
f = inline('(-1.5*t) .* ((t>-3)&(t<0)) + (3) .* (t = 0) +(t) .* ((t>0)&(t<3))');
But I am getting an error when I use the same plot command.
plot(t, f(t), 'r','linewidth', 2);
Can anybody suggest the correct method.?
The error is because you have
(t = 0)but you probably wanted(t == 0)i.e.
now
f(0)gives 3