Question: I've the following matlab code written by myself, in the course of Signal and Systems Fourier Series. How to get the input x ( t
I've the following matlab code written by myself, in the course of Signal and Systems Fourier Series. How to get the input xt in frequency domain with the theory of coefficients of fourier series being the frequency domain, Dont use fourier transform to obtain the frequency domain because there are two methods to get frequency domain right? And obtain the low pass filter's output in frequency domain, Yf by using theory of outputcoefficient ck Hk where ck is the coefficient of input signal. And then get the output in time domain, Yt back by using inverse fourier transform ytck Hk ejkt Use MATBLAB. Will upvote if give good answer, and vice versa. Thank you.
Defining all the parameters
Parameters
fe; Fundamental frequency Hz
T f;
How to convert to fundamental angular frequency rads
omega pi f;
Define the xaxis,
t T : e : T; Time vector for periods
The dc component was obtained from manual solution
DCComponent ;
Computing the input,in time domain, xt and its plot
Initialize the signal
ACComponent zerossizet;
ACComponent zerossizet;
ACComponent zerossizet;
Since n Odd Harmonics until the number of harmonics wanted
Therefore, Loop from to X with increment of has syntax as shown
for n ::
harmonics
if n
The equation below was copied directly from manual solution
bn n pi;
ACComponent ACComponent bn sinn omega t;
end
if n
bn n pi;
ACComponent ACComponent bn sinn omega t;
end
if n
bn n pi;
ACComponent ACComponent bn sinn omega t;
end
end
Add the DC component here, because DC component is constant, and don't
need to be looped! Only the AC component is looped
xt DCComponent ACComponent;
xt DCComponent ACComponent;
xt DCComponent ACComponent;
figure; This "figure" use only once, so that all subplots appear in fugure
subplot
How to let the line to be black, and line width to be
so that it is beautiful?
plott xtk 'LineWidth', ;
titlext;
xlabelTime s;
ylabelAmplitude;
Since I want to show the y axis from to then following
syntax is used, because I want y to be at center exactly like
the question given, it's put here behind of each subplot or it
won't work!
ylim;
subplot
plott xtk 'LineWidth', ;
titleFourier Series Approximation of xt;
xlabelTime s;
ylabelAmplitude;
ylim;
subplot
plott xtk 'LineWidth', ;
titleFourier Series Approximation of xt;
xlabelTime s;
ylabelAmplitude;
ylim;
Plotting the input, in frequency domain, Xw and its plot
Plotting the Low Pass Filter's Frequency Response Curve
The Cutoff frequency given, in Hz
fc e;
f : e : e; This really need to trial and error to get the smooth curve
Inputting the transfer function derived manually,
Input log instead of log it produces different result
Define the LowPass Filter Transfer function derived from my manual method
Magnitude only
Hfmagitude sqrtf fc;
Conver to gain dB
gain logHfmagitude;
Start another figure
figure;
I want the xaxis to have unit of scale of kHz so I make all the f to be
devided by or e
Since I want the curve to be black colour, black is k
plotfe gain,k 'LineWidth', ;
titleFrequency Response Curve of Low Pass Filter';
This curve is actually a hard fact, every fc gives different curve!
But just depend on where is my f
fc only, just plotting the transfer function only
xlabelFrequency kHz;
ylabelGain dB;
Make the axis show from to khz only
xlim;
grid on;
Since the fc should give a gain of dB theoretically
To verify this, fc and dB line was plotted
Dashed line, so use solid line, use followed by the code of colour
Want the label alligned vertically degree rotated then put
'LabelVerticalAlignment' at behind,
Plot my fc line
xlinefc eb 'Cutoff Frequency fc 'LabelVerticalAlignment', 'bottom';
Plot my f line
xlineb 'Input Frequency f 'LabelVerticalAlignment', 'top';
Plot the dB horizontal line
ylineb dB 'LabelHorizontalAlignment' 'center';
Computing the output and its plot
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
