Generate a sinus signal and plot the output
Show older comments
Hello, I'm stuck on a problem that I don't really know how to solve. I'm suppose to do these tasks:
Generate a signal 𝑓(𝑡) = sin (𝜔1𝑡) + sin (𝜔2𝑡), 𝜔1 = 0.1 rad/s and 𝜔2 = 10 rad/s. Use the
sampling frequency Fs = 100 Hz to sample the signal. Create a time axis with 8192 ( = 2^13)
samples. Filter the input signal through the circuit. Plot the input signal and the output signal
in the same diagram. Explain what happened to the input signal based on the Bode
diagram.
When i tried to code this I got an output, however the graph became a giant clump. I immediately checked it and it was wrong. Here's my code:
dt = 1/100;
tmin = 0;
tmax = 2^13;
t = tmin:dt:tmax;
T1 = 20*pi;
f1 = 1/T1;
T2 = 0.2*pi;
f2 = 1/T2;
x = sin(2*pi*f1*t) + sin(2*pi*f2*t);
stem(t,x);
This code is exclusive of the filtering and the bodeplot because I want to get the function and time graph right. Does anyone know what I've done wrong?
Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

