MATLAB: Piece wise function with variables Invalid indexing or function definition.

errorMATLABpiecewise

I am trying to plot a piecewise function that has input variables and am receiving an error:
%Test%
clear all
clc;
T=0.004;
F=12e+4;
syms t
y = piecewise(0<=t<=(T/4), (8*F*t)/(3*T), (T/4)<=t<=(T/2), (8*F/6)*(1-(2*t/T)), (T/2)<=t<=(3*T/4), -F*(1-(2*t/T)), (3*T/4)<=t<=T, 4*F(1-(t/T)));
fplot(y, [0,T])

Best Answer

Your last component has
4*F(1-(t/T))
which asks to index F at location 1 - t/T where T is symbolic. You cannot index an array at a symbolic location.