Question in continuous time signals

조회 수: 1(최근 30일)
Fotis Val
Fotis Val 2021년 11월 25일
답변: VBBV 2021년 11월 25일
I'm not sure about the represantation of a continuous time signal. Am I doing something wrong?
%%
DT = 0.01;
t = [-2:DT:12];
%% Question 2.1
%Parts of Signal
t1 = -2:DT:7;
y1_1 = (exp(abs(-0.5*t1))).*(2*sin(10*pi*t1)+cos(1*pi*t1));
t2 = 8:DT:12;
y1_2 = (0.75).^abs(-t2+10);
% Final Signal
%t = [t1 t2];
y1 = [y1_1 y1_2];
%% Question 2.2
%Parts of Signal
t1 = -2:DT:7;
y2_1 = (exp(abs(-0.5*(-t1-2)))).*(2*sin(10*pi*(-t1-2)))+cos(1*pi*(-t1-2));
t2 = 8:DT:12;
y2_2 = (0.75).^abs(t2+12);
% Final Signal
t = [t3 t4];
y2 = [y2_1 y2_2];
%% Conv Function
tconv = (t(1) +t(1):DT:t(end)+t(end));
F1 = conv(y1,y2)*DT;
stem(tconv,F1);

답변(3개)

Image Analyst
Image Analyst 2021년 11월 25일
Why are you going from 8 to 12 instead of (7+DT) to 12?

Star Strider
Star Strider 2021년 11월 25일
Everything in a computer are discrete, not continuous (except the voltages on the chips themselves and the outputs of a soundcard or similar DAC transducers). So ‘continuous’ signals otherwise only exist in symbolic variables, not numeric arrays or vectors, since by definition those are all sampled.
The posted code is doing everything it should (or could) to represent the signal vectors correctly (although some variables appear to be missing).
%%
DT = 0.01;
t = [-2:DT:12];
%% Question 2.1
%Parts of Signal
t1 = -2:DT:7;
y1_1 = (exp(abs(-0.5*t1))).*(2*sin(10*pi*t1)+cos(1*pi*t1));
t2 = 8:DT:12;
y1_2 = (0.75).^abs(-t2+10);
% Final Signal
%t = [t1 t2];
y1 = [y1_1 y1_2];
figure % Added
plot([t1 t2], y1) % Added
grid % Added
%% Question 2.2
%Parts of Signal
t1 = -2:DT:7;
y2_1 = (exp(abs(-0.5*(-t1-2)))).*(2*sin(10*pi*(-t1-2)))+cos(1*pi*(-t1-2));
t2 = 8:DT:12;
y2_2 = (0.75).^abs(t2+12);
% Final Signal
t = [t3 t4];
Unrecognized function or variable 't3'.
y2 = [y2_1 y2_2];
%% Conv Function
tconv = (t(1) +t(1):DT:t(end)+t(end));
F1 = conv(y1,y2)*DT;
stem(tconv,F1);
.

VBBV
VBBV 2021년 11월 25일
DT = 0.01;
t = [-2:DT:12];
%%Question 2.1
%Parts of Signal
t1 = -2:DT:7;
y1_1 = (exp(abs(-0.5*t1))).*(2*sin(10*pi*t1)+cos(1*pi*t1));
t2 = 8:DT:12;
y1_2 = (0.75).^abs(-t2+10);
% Final Signal
%t = [t1 t2];
y1 = [y1_1 y1_2];
%%Question 2.2
%Parts of Signal
t1 = -2:DT:7;
y2_1 = (exp(abs(-0.5*(-t1-2)))).*(2*sin(10*pi*(-t1-2)))+cos(1*pi*(-t1-2));
t2 = 8:DT:12;
y2_2 = (0.75).^abs(t2+12);
% Final Signal
t = [t1 t2];
y2 = [y2_1 y2_2];
%%Conv Function
tconv = (t(1) +t(1):DT:t(end)+t(end));
F1 = conv(y1,y2)*DT;
stem(F1);
figure(2);
plot(t,y1,t,y2)
The variables t3 and t4 are same as t1 and t2. So your discrete and continuous signal representations do match well.

Community Treasure Hunt

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

Start Hunting!

Translated by