Plotting a high frequency sine

11 views (last 30 days)
MerTesla
MerTesla on 1 Apr 2023
Answered: Walter Roberson on 1 Apr 2023
Hello to all, I am a EE student who tries to learn MATLAB, I had homework about Fourier Series and LTI systems response, and I found the response of the filter as
y = ((-36/(pi^2))*sin(2*pi*10^3*t)) - ((28/(9*pi^2))*sin(2*pi*3*10^3*t))-((4/(5*pi^2))*sin(2*pi*5*10^3*t))-((12/(49*pi^2))*sin(2*pi*7*10^3*t))-((4/(81*pi^2))*sin(2*pi*9*10^3*t))
I need to plot this function, but when I try to do it, it looks like nonsense. Also, I do not know how should I set the interval of the independent variable "t", and I think this might be the problem. But the period of the input signal to the filter is 1mS and the filter's bandwidth is 10kHz.
If you can help I would be very appreciated it. I'm adding my codes below. Thanks in advance.
My Code:
t=-10^-3:10^3;
y = ((-36/(pi^2))*sin(2*pi*10^3*t)) - ((28/(9*pi^2))*sin(2*pi*3*10^3*t))-((4/(5*pi^2))*sin(2*pi*5*10^3*t))-((12/(49*pi^2))*sin(2*pi*7*10^3*t))-((4/(81*pi^2))*sin(2*pi*9*10^3*t))
y = 1×1001
1.0e-08 * -0.0000 0.0001 0.0001 0.0005 0.0012 0.0025 0.0028 0.0034 0.0038 0.0015 0.0019 -0.0004 0.0029 0.0008 0.0037 0.0025 -0.0004 0.0094 0.0083 0.0129 0.0091 0.0136 0.0055 0.0091 0.0118 0.0149 0.0089 0.0115 0.0133 0.0067
plot(t,y);
xlabel("t")
ylabel("y(t)")

Answers (1)

Walter Roberson
Walter Roberson on 1 Apr 2023
Pi = sym(pi);
syms t real
y = ((-36/(Pi^2))*sin(2*Pi*10^3*t)) - ((28/(9*Pi^2))*sin(2*Pi*3*10^3*t))-((4/(5*Pi^2))*sin(2*Pi*5*10^3*t))-((12/(49*Pi^2))*sin(2*Pi*7*10^3*t))-((4/(81*Pi^2))*sin(2*Pi*9*10^3*t))
y = 
If you look at that you can see there is a sine wave of frequency 9000 Hz -- but it has low amplitude so it is difficult to see.
The most you can see is to roughly
fplot(y, [0 0.03])
which is pretty boring.
When you go to 1000 like you do, in 1 Hz increments, you get a lot of aliasing.

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!