MATLAB: I have a code but it keep saying “invalid expression. when calling a function or indexing a variable, use parentheses. otherwise check for mismatched delimiters.

please help

F=[];
A=[];
for f=0:200:1800
F =[F,f]; %in HZ
f0 = 500;% in Hz

f1= 1500;% in Hz
N = 20;
a = 0:5:25
a= abs((a*sin[pi(f-f0)*N]))/ (sin[pi(f-f0)]))+ abs((a*sin[pi(f-f1)*N]))/ (sin[pi(f-f1)]));
A= [A, a];
end
plot (F, A)

Best Answer

Hi Roolientha,
Your expression is invalid because you are calling a function sin with brackets not paranthesis.
sin[..] %check and correct them with paranthesis
sin(..) %because sin is a function like abs,plot,etc
Related Question