f = @(t) sin(t).*(sin(t)>=0) + 0*(sin(t)<0); % Half-Wave Rectified Sine Function
t = linspace(0, 4*pi);
figure(1)
plot(t, f(t))
grid
axis([0 4*pi -1.5 1.5])
To pass the value of the‘f’ function to your‘Fourierseries’ function, since you are not evaluating itwithin the function, evaluate it first, and pass that to your function:
Best Answer