Plot a Signal Function

์กฐํšŒ ์ˆ˜: 9 (์ตœ๊ทผ 30์ผ)
Sina
Sina 2022๋…„ 11์›” 7์ผ
๋Œ“๊ธ€: Walter Roberson 2022๋…„ 11์›” 7์ผ
I am trying to plot a signal in Matlab for
-1.5โ‰คdtโ‰ค1.5:
x(t) = sin(pi*t)rect(t)
where rect(t) is the rect function.
and I am trying to obtain and plot the magnitude of ๐‘‹(๐‘“) the Fourier transform of ๐‘ฅ(๐‘ก) of that.
  ๋Œ“๊ธ€ ์ˆ˜: 2
Walter Roberson
Walter Roberson 2022๋…„ 11์›” 7์ผ
dt can be negative? Your difference between time steps can be negative?? (You have a bit of a meaning question about what exactly should happen for the case where dt = 0, where all times are exactly the same.)
Walter Roberson
Walter Roberson 2022๋…„ 11์›” 7์ผ

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์ฑ„ํƒ๋œ ๋‹ต๋ณ€

Sina
Sina 2022๋…„ 11์›” 7์ผ
clear all
close all
clc
fs= 600; %This Sampling Frequency
dt = 0.001;
T = -1.5:dt:1.5;
fs=1/dt;
f=(-1/2:1/length(T):1/2-1/(length(T)*2))*fs;
y=sin(pi*T).*rectangularPulse(T);
yf = fftshift(fft(y));
z=abs(yf);
plot(f, z);
title("Plot for the Signal");
xlabel("Frequency")
ylabel("X(f):the Fourier transform of ๐‘ฅ(๐‘ก)")
  ๋Œ“๊ธ€ ์ˆ˜: 1
Walter Roberson
Walter Roberson 2022๋…„ 11์›” 7์ผ
Note that rectangularPulse requires the Symbolic Toolbox

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์ถ”๊ฐ€ ๋‹ต๋ณ€ (0๊ฐœ)

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Digital Filter Analysis์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

Community Treasure Hunt

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

Start Hunting!

Translated by