How does one plot $y=|x|$ in MATLAB?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
What does gibbs/fourier have to do with absolute value? Are you supposed to get its fourier expansion and then plot it against the absolute value function? Because that will exhibit gibbs phenomenon.
If you just want to plot y=abs(x), then just do
x = -10:0.01:10; y = abs(x); plot(x,y)
If you need the fourier expansion, MATLAB is not the way to do it. I would do it by hand analytically or use some symbolic software like MATHEMATICA. But if you use mathematica, then might as well plot in it too. It's easier and you get prettier pictures too.