Question in continuous time signals

1 view (last 30 days)
Fotis Val
Fotis Val on 25 Nov 2021
Answered: Star Strider on 25 Nov 2021
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);

Answers (2)

Image Analyst
Image Analyst on 25 Nov 2021
Why are you going from 8 to 12 instead of (7+DT) to 12?

Star Strider
Star Strider on 25 Nov 2021
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);
.

Categories

Find more on Fourier Analysis and Filtering 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!