To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
x=linspace(-4,8,500); y=(square((x*(3/2)+3))); t=(sawtooth((x*(3/2)+3))); v=[-4 8 0 2]; s=(3/2)/2; for n=1:3 a=-(2)/(n^(2)*pi^2); b=-(1)/(n*pi); s=s+a*cos((n*pi*x)/2)+b*sin((n*pi*x)/2); figure(1),subplot(2,2,n),plot(x,y,x,s,x,t),axis(v) end
The above is what I have so far, and it looks sort of how I want it to look, except I want it to not have a line because of the use a mix of sawtooth and square waves to make it look like a proper trapezoidal wave. Also it should be periodic T+4 as opposed to 2pi periodic as sawtooth and square functions have as standard.
Any help is greatly appreciated.
No products are associated with this question.