Borrar filtros
Borrar filtros

Using Fourier Series write a MATLAB function to synthesize the wave-form in problem (2-19), Assume A = 4mV. Your function should take n ( # of harmonics ) and produce a plot

30 visualizaciones (últimos 30 días)
I am trying to plot the fourier series for the graph
I was told to assume that A=4mV and that the A value occurs at time 4mS. I was able to figure out the fourier equation in matlab should be
syms t
T=0.01
w=200*pi;
An1=(2/T)*((int(t*cos(w*N*t),t,0,0.004)));
An2=(2/T)*((int((-4*t+0.020)*cos(w*N*t),t,0.004,0.005)));
An3=(2/T)*((int((-1*t+0.005)*cos(w*N*t),t,0.005,0.009)));
An4=(2/T)*((int((4*t-0.036)*cos(w*N*t),t,0.009,0.01)));
AnT=An1+An2+An3+An4;
Bn1=(2/T)*((int(t*sin(w*N*t),t,0,0.004)));
Bn2=(2/T)*((int((-4*t+0.020)*sin(w*N*t),t,0.004,0.005)));
Bn3=(2/T)*((int((-1*t+0.005)*sin(w*N*t),t,0.005,0.009)));
Bn4=(2/T)*((int((4*t-0.036)*sin(w*N*t),t,0.009,0.01)));
BnT=Bn1+Bn2+Bn3+Bn4;
V(t)=(AnT*cos(w*N*t))+(BnT*sin(w*N*t));
But I have no clue how to correctly plot this information to correctly get the fourier
  1 comentario
William Rose
William Rose el 11 de Sept. de 2023
@Evan, read the help on plot(...). And consider stem(...) which is not bad for plotting the Fourier coefficients.
General idea could be
subplot(211); stem(frequencies, magnitudes)
subplot(212); stem(frequencies, phase angles)
where you put in suitable substitues for frequencies, magnitudes, phases. Look up the details and optinal parameters to make your plots look nice.

Iniciar sesión para comentar.

Respuestas (1)

Paul
Paul el 12 de Sept. de 2023
Hi Evan
First, check your code that defines one period of v(t). It''s probably easier to define v(t) using piecewise
syms t
T=0.01;
w=200*pi;
v(t) = piecewise( ...
0<=t<0.004,t, ...
0.004<t<=0.005,-4*t+0.020, ...
0.005<t<=0.009,-1*t+0.005, ...
0.009<t<=.01, 4*t-0.036,0);
Here's the plot, from which it's apparent the fourth segment is not correct.
figure
fplot(v(t),[0 T]),grid
If you choose to define one period of v(t) using piecewise, then you can use that expression to comput expressions for An and Bn in terms of N.
Once you have those expressions you can use subs to compute An and Bn at integer values of N and compute the Fourier series summation from those results.
If you try all of this and get stuck, feel free to post back with updated code and explain where the sticking point is.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by