plot Gibbs phenomenon individually???
6 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250156/image.png)
1. In exponential fourier series as above equation(1111.png), theoritically gibb's phenomenon is summation of Xn as above equation (1111.png)... The larger the summation of XN the waveform will get back to its original waveform
2. My question is as in below image (2222.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250157/image.png)
3. I want to plot seperately X1, X2, X3,X4 and X5 ( gibbs phenomenon) . after that I want to plot the summation of yT= X1 + X2 +X3 +X4 +X5
4. I have code it by referring some of the sources in internet as in below image (3333.png).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250158/image.png)
5.the waveform shape of yT= X1 + X2 +X3 +X4 +X5 is okay. but if we compare the amplitude of yT is not same as the original waveform as in (2222.png)
6. I attached the file of my coding name "individual n=1,2,3,4,5 & sum.m"
2 个评论
David Goodmanson
2019-11-25
.Hi Neptune,
I don't believe that what you are showing here so far is the Gibbs phenomenon. The wiggles you see will get smaller and smaller as the number of terms N goes up. However, there will be a permanent overshoot right where the discontinuitiy of the function is. The overshoot waveform will get narrower as N increases, but the height will remain basically the same. See the plots in Wikipedia, for example.
采纳的回答
David Goodmanson
2019-11-26
编辑:David Goodmanson
2019-11-26
Hi Neptune,
I agree that my comment on what the Gibbs phenomenon actually is was not very helpful to the actual problem at hand. The expression for the sawtooth is
A*( 1/2 - Sum((1/(pi*n))*sin(n*w0*t)) ).
where A is the double amplitude of the triangle wave, A = 4 in this case. Since the coefficients are A / (pi*n), your code is too low by a factor of 2. With the method you used, if you had included both positive and negative frequencies in the sum instead of just the positive ones, you would have got the factor of 2.
You have c0 = 2 in the code but it is not being added in successfully. Also your for loops are not exactly for loops since each set of instructions is only done once.
Making a new variable name for every value of n (dynamic variable naming) as you are doing is highly unrecommended. For one thing, if you want to do this process for, say, 100 terms, it’s just not practical. Rather than naming row vectors c1,c2 etc. it’s much better to put all the rows into a matrix and address each row with a row index. So you can do the following.
t = -10:.1:30;
wo=pi/5;
c0 = 2; % c0 = A/2
N= 5;
y = zeros(N,length(t)); % n index down, time across
for n = 1:N
cn1 = 4j/(n*pi);
y(n,:) = real(cn1*exp(1j*n*wo*t)); % drop it into the appropriate row
end
yT = c0 + sum(y); % sum down each column for the sum c1,c2,c3 ...
figure(1)
plot(t,yT);
grid on
Now to do 50 terms you just change N to 50. I hope you will agree that this is highly efficient compared to making a new variable name for every term.
If you do change N to 50 you can see the actual Gibbs phenomenon which are the spikes at y = 4.3 and y = –0.3, approximately. Those get narrower with large N, but they don’t go away. Everywhere else the fourier sum gets closer and closer to the sawtooth wave.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!