Professional Documents
Culture Documents
clear all
close all
n = n_lower : n_upper;
x = [n==0];
xlabel('Time in Seconds')
x = [n>=0];
xlabel('Time in Seconds')
x = n.*[n>=0];
xlabel('Time in Seconds')
%% Exponential Sequence
e = exp(a.*n);
xlabel('Time in Seconds')
Convolution:
xn=input('enter the sequence 1 ');
l1=length(xn);
hn=input('enter the sequence 2 ');
l2=length(hn);
m=l1+l2-1;
z=zeros(1,m);
z=conv(xn,hn);
z1=zeros(1,m);
disp(z);
xnl1=[xn,zeros(1,l2-1)];
disp(xnl1);
hnl1=[hn,zeros(1,l1-1)];
disp(hnl1);
for i=1:m
for j=1:i
z1(i)=z1(i)+xnl1(j)*hnl1(i-j+1);
end;
end;
disp(z1);
>> convolution
1 4 10 12 9
1 2 3 0 0
1 2 3 0 0
1 4 10 12 9
%% *** Reading The Audio Signal *** %%
[n, Fs] = audioread('C:\Users\Acer\Downloads -dragon.mp3');
% Where n = Number of data in the audio signal % And Fs = no of Samples
per second in the audio signal
sound(n)
% This Function Plays the audio
for i = 1 : (length(r));
y(2*i - 1) = r(i);
y(2*i) = 0;
end
% The upper loop will pad zero to the even positions of matrix y
p2 = audioplayer(r,12000); % Sampling Frequency = 12000
play(p2); %
%%program for Time Compression %%
% We can decrease the sample number for compressing the signal
for i = 1 : (length(r))/2;
y2(i) = r(2*i);
end
% The upper loop will be responsible for cancelling the odd elements in
signal x
clc
clear all
close all
% Taking the image as input
% RGB Image
img = uigetfile('*', 'Select your image');
x = imread(img);
figure(1)
imshow(x)
% GrayScale Image
x1 = rgb2gray(x);
figure(2)
imshow(x1)