MATLAB: Help debugging the program for plotting ezplot of sin and cos

ezpot

x=0:1:pi;
a=@(x) sin(pi*x);
y=@(x) cos(4*pi*x);
ezplot(a,0,2);
hold on;
ezplot(y,0,2);

Best Answer

x=0:1:pi;
a=@(x) sin(pi*x);
y=@(x) cos(4*pi*x);
ezplot(a,[0,2]); % you forgot to add [ ] brackets
hold on;
ezplot(y,[0,2]);
see the attached screenshot of the graph produced
Screen Shot 2018-12-06 at 12.46.47 PM.png