Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Lab NO.

11:

Making of continuous time signals causal and non causal in Matlab


Lab. Objective:

To obtain simulation skills of how to make a signal causal and non causal in Matlab.

Tools:

PC, Matlab.

Theory:

Causal signal:

The signal which amplitude exists on time (t<0) is called causal signals.

Nom causal signals:

The signal which amplitude exists on time (t>=0) is called non causal signals.

Making sine signal causal:

Matlab code:

t=-2:0.01:2; %defining time for signal

A=10;%defining amplitude for signal

f=5;%defining frequency for signal

x=A*sin(4*pi*f*t);%defining sine signal

subplot(2,1,1);%Matlab built-inn command for multiplotting

plot(t,x)%plotting the signal

legend('input sine signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

u=(t<0);%defining function to make signal causal

y=x.*u;%multiplying function with signal

subplot(2,1,2);%Matlab built-inn command for multiplotting

plot(t,y)%plotting the causal signal


legend('causal sine signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

10
input sine signal
5

-5

-10
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

10
causal sine signal
5

-5

-10
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

Figure 1: Making of sine signal causal

Making sine signal Non causal:

Matlab code:

%%Making sine signal non causal%%

t=-2:0.01:2; %defining time for signal

A=5;%defining amplitude for signal

f=3;%defining frequency for signal

x=A*sin(2*pi*f*t);%defining sine signal

subplot(2,1,1);%Matlab built-inn command for multiplotting

plot(t,x)%plotting the signal

legend('input sine signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

u=(t>=0);%defining function to make signal causal

y=x.*u;%multiplying function with signal


subplot(2,1,2);%Matlab built-inn command for multiplotting

plot(t,y)%plotting the non causal signal

legend('non causal sine signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

5
input sine signal

-5
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

5
non causal sine signal

-5
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

Figure 2: Making of sine signal non causal

Making of Decaying exponential signal causal and non causal

Matlab code:

%%Making decaying exponential signal causal and non causal%%

t=-5:0.01:5; %defining time for signal

A=5;%defining amplitude for signal

a=3;%defining variable of decaying exponential signal

x=A*exp(-a*t);%defining decaying exponential signal

subplot(3,1,1);%Matlab built-inn command for multiplotting

plot(t,x)%plotting the signal

legend('input decaying exponential signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph


u=(t<0);%defining function to make signal causal

y=x.*u;%multiplying function with signal

subplot(3,1,2);%Matlab built-inn command for multiplotting

plot(t,y)%plotting the non causal signal

legend('causal sine signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

u=(t>=0);%defining function to make signal non causal

y=x.*u;%multiplying function with signal

subplot(3,1,3);%Matlab built-inn command for multiplotting

plot(t,y)%plotting the non causal signal

legend('non causal decaying exponential signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

7
x 10
2
input decaying exponential signal

0
-5 -4 -3 -2 -1 0 1 2 3 4 5
7
x 10
2
causal sine signal
1

0
-5 -4 -3 -2 -1 0 1 2 3 4 5
6
non causal decaying exponential signal
4

0
-5 -4 -3 -2 -1 0 1 2 3 4 5

Figure 3: Making of decaying exponential signal causal and noncausal

Making of Even function causal and Non causal:

Matlab Code:

%%Making even function causal and non causal%%


t=-2:0.01:2; %defining time for signal

x=t.^4;%defining even function

subplot(3,1,1);%Matlab built-inn command for multiplotting

plot(t,x)%plotting the function

legend('input even function')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

u=(t<0);%defining function to make the function causal

y=x.*u;%multiplying both the functions

subplot(3,1,2);%Matlab built-inn command for multiplotting

plot(t,y)%plotting the causal function

legend('causal even function signal')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph

u=(t>=0);%defining function to make function non causal

y=x.*u;%multiplying both the functions

subplot(3,1,3);%Matlab built-inn command for multiplotting

plot(t,y)%plotting the non causal function

legend('non causal even function')%Matlab built-inn command for labelling

grid on %Matlab built-inn command for lines on graph


20
input even function

10

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
20
causal even function signal

10

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
20
non causal even function

10

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

Figure 4:Making of even function causal and noncausal

Lab. Assignment:

Make the following trigonometric expression causal and non causal.

Y= (a/√b (b)c tan(√d pi t) + (d/e)2 sin (t))

You might also like