how to compute the complex Fourier series expansion of half-wave re... (2024)

17 views (last 30 days)

Show older comments

WJ on 12 Aug 2020

  • Link

    Direct link to this question

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas

  • Link

    Direct link to this question

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas

Answered: EE_student on 19 Jun 2021

My Question in the title, i am new to matlab and i need help with this please

how to compute the complex Fourier series expansion of half-wave re... (2)

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Answers (4)

Sulaymon Eshkabilov on 12 Aug 2020

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_478788

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_478788

Hi,

Here are several nice tutorial examples of matlab on Fourier Transform.

https://www.mathworks.com/help/matlab/math/fourier-transforms.html

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Star Strider on 12 Aug 2020

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_478794

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_478794

My impression is that this is homework. We give hints for homework, not complete code. (You must write the code. We will help you to get your code to run if you have problems with it.)

It is straightforward to compute the Fourier transform symbolically. You need to remember also to allow for the part of the signal that is zero in the time range that you are computing it.

You already discovered Hi how do i plot a halfwave rectifier signal in matlab? i tried the coding below and only got the fullwave (since you posted a Comment to it to request thatI look at this Question), all you then need to do is to read the documentation for fft and use that with the signal I provided in that Answer.

9 Comments

Show 7 older commentsHide 7 older comments

WJ on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970044

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970044

its actually not a homework, i am trying to check the amplitude and the phase, for my own study, but i never used matlab before and idont even know how to code, i know the coefficants of the series and the idea of phasing, but i dont know how to use this app thats why i am asking for some help, please help me and thanks

WJ on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970047

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970047

and the thing is that i dont even have the function of the half wave rectified so i can use fft

Star Strider on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970113

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970113

In that instance, use the second part of my Answer and plot the fft of the half-wave rectified signal.

The table that you posted appears to require a context that is not provided.

WJ on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970128

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970128

i am trying to

f=50;

t=linspace(0,30,500);

x=sin(2*pi*f*t);

rect_sig = sig > 0;

y = fft(x);

f = (0:length(y)-1)*50/length(y);

plot(f,abs(y))

title('Magnitude')

subplot(221)

stem(t,abs(sig))

i cant get the amplitude spectra

it should be straight lines, any help?

WJ on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970134

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970134

i fixed it a little bit

l=linspace(0,10,100);

sig=sin(2*pi*50*l);

subplot(211)

plot(sig);

grid

% u=1:9;

% t=(1:)

for t=1:100

if sin(2*pi*50*l(t))<=0

sig(t)=0;

else

sig(t) = sin(2*pi*50*l(t));

end

end

subplot(212)

plot(sig);

grid

stem(l,abs(sig),'b')

still cant get straight lines

whats the issue?

Star Strider on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970158

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970158

Open in MATLAB Online

Try this slightly modified version of your code:

f=50;

t=linspace(0,30,500);

Fs = 1/(t(2)-t(1));

Fn = Fs/2;

sig=sin(2*pi*f*t);

rect_sig = sig.*(sig > 0); % Half-Wave Rectification

y = fft(rect_sig)/numel(sig);

f = linspace(0, 1, fix(numel(sig)/2)+1)*Fn; % Frequency Vector

idx = 1:numel(f); % Index Vector

% f = (0:length(y)-1)*50/length(y);

figure

subplot(2,1,1)

semilogy(f,abs(y(idx))*2)

title('Magnitude')

grid

subplot(2,1,2)

plot(f,unwrap(angle(y(idx))))

title('Phase')

grid

figure

% subplot(221)

stem(t,rect_sig)

.

WJ on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970176

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970176

how can i change the magnitude to amplitude?

i know i made trouble for you but i reaLLY APPRECIATE IT

WJ on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970179

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970179

Edited: WJ on 12 Aug 2020

how can i make the amplitude and phase look like this? as straight lines

or is it just like this when n= a constant number?how to compute the complex Fourier series expansion of half-wave re... (13)

Star Strider on 12 Aug 2020

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970230

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#comment_970230

Open in MATLAB Online

To get the amplitude (amplitude = magnitude) spectrum such as in the plot image, use the fftshift function, then plot using a symmetric frequency vector, for example:

sy = fftshift(y);

sf = linspace(-10,10, numel(sy));

then:

figure

stem(sf, sy)

or something similar.

Sign in to comment.

Swapnil Khot on 8 May 2021

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_695200

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_695200

How we write code for half wave rectifier using Fourier series

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

EE_student on 19 Jun 2021

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_728375

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/578715-how-to-compute-the-complex-fourier-series-expansion-of-half-wave-rectified-signal-and-plot-its-phas#answer_728375

Wait have you sorted it out?

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Categories

MATLAB

Find more on MATLAB in Help Center and File Exchange

Tags

  • fourier series
  • complex series
  • matlab
  • spectra
  • amp
  • amplitude
  • half wave rectified signal

Products

  • MATLAB

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


how to compute the complex Fourier series expansion of half-wave re... (17)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

Contact your local office

how to compute the complex Fourier series expansion of half-wave re... (2024)

References

Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 6032

Rating: 4.9 / 5 (49 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.