Hello i think this should be easy but I'm stuck in it (function graphing)

Hello, can you help me with this graphing question please?? i keep getting errors
-this is the mathematical question:-
in the same window, for x between x=0 and x= 2*pi, plot the two functions when a = 16
1- y=sin x
2- y = sin ( x - 4*pi/a)
-this is my attempt :-
a=16; fplot('sin(x)',[0,2*pi]) %the first graph appeared
hold on
fplot('sin(x-4*pi/a)',[0,2*pi])
Error using inline/feval (line 22)
Not enough inputs to inline function.
Error in fplot (line 101) x = xmin; y = feval(fun,x,args{4:end});

 Accepted Answer

It’s not picking up ‘a’ from your workspace. An anonymous function will:
a=16;
fplot(@(x) sin(x), [0,2*pi]) %the first graph appeared
hold on
fplot(@(x) sin(x-4*pi/a), [0,2*pi])

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!