Wednesday 19 November 2014

Monday 10 November 2014

MATLAB Code For SAMPLING THEORM



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
%%% sampling theorm %%%%%%%%%%%%%5
%%% x= sin(2*pi*f1*n)+cos(2*pi*f2*n) %%%%
%%% with f1= 2/128 & f2 = 4/128 %%%%%

clc;
close all;
clear all;
f1=2/128;
f2=4/128;
n=0:255;
fc=50/128;
x=sin(2*pi*f1*n)+cos(2*pi*f2*n);
xa=cos(2*pi*fc*n);
xamp=x.*xa;
subplot(2,2,1);plot(n,x);title('x(n)');
xlabel('n -->');
ylabel('amplitude');
subplot(2,2,2);
plot(n,xa);
title('xa(n)');
xlabel('n -->');ylabel('amplitude');
subplot(2,2,3);plot(n,xamp);
xlabel('n -->');ylabel('amplitude');

%%%%%%%%%%%%%%%%%%%%%%%%

 



Download Project for B.E, B.Tech, BCA, MCA, M.E, M.Tech, B.Sc, M.Sc and Polytechnic



MATLAB Code For HISTOGRAM Comparison Of Images





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all
clc;
clear all;

im= imread(input('Enter the name of image :  ',  's'));
im = rgb2gray(im);
im_0=histeq(im);
im_1=exact_histogram(im);

H=imhist(im);
H_0=imhist(im_0);
H_1=imhist(im_1);

% Original image
%--------------------------------------------------------------------------
figure('color',[1 1 1]) 
h_im=axes('units','normalized','position',[0.05 0.1 0.4 0.8]);
imshow(im)

h_h=axes('units','normalized','position',[0.55 0.1 0.4 0.8]);
bar(0:255,H,'b');
set(h_h,'xlim',[0 255],'FontSize',15,'FontWeight','bold')
set(get(h_h,'Title'),'String','Original Image','FontSize',20,'FontWeight','bold')

Ylim_ref=get(h_h,'ylim');


% Classical histogram equalization
%--------------------------------------------------------------------------
figure('color',[1 1 1]) 
h_im=axes('units','normalized','position',[0.05 0.1 0.4 0.8]);
imshow(im_0)

h_h=axes('units','normalized','position',[0.55 0.1 0.4 0.8]);
bar(0:255,H_0,'b');
set(h_h,'xlim',[0 255],'ylim',Ylim_ref,'FontSize',15,'FontWeight','bold')
set(get(h_h,'Title'),'String','Classical Histogram Equalization','FontSize',20,'FontWeight','bold')



Download Project for B.E, B.Tech, BCA, MCA, M.E, M.Tech, B.Sc, M.Sc and Polytechnic



MATLAB Code For Amplitude Modulation



Fig: Amplitude Modulation

AM is a method of transmitting signals, such as sound or digital information, in which the amplitude of carrier wave is changed

according to the message signal. AM is widely used in electronic communication field. The plotting of AM signal using MATLAB

is very easy.

%%%%%%%%%%% Amplitude Modulation %%%%%%%
clc;
clear all;
close all;
t=0:0.001:1;
set(0,'defaultlinelinewidth',2);
A=input('Enter the amplitude of message signal - :  ');
fm=input('Enter the Message frequency - :  ');% Message signal frequecny
fc=input('Enter the Carrier frequency - :  ');% Carrier signal frequency
mi=input('Modulation Index - : ');

if (mi >1 || mi < 0 )
disp('Enter value between 0 and 1');
break;
end
x=A*sin(2*pi*fm*t);%Message Signal
subplot(3,1,1);%Plotting frame divided in to 3 rows and this fig appear at 1st
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Message Signal');
grid on;

c=A*sin(2*pi*fc*t);%Carrier Signal
subplot(3,1,2);
plot(t,c);
xlabel('Time');
ylabel('Amplitude');
title('Carrier Signal');
grid on;

am=(A+mi*x).*sin(2*pi*fc*t);%AM Signal, Amplitude of Carrier changes to (A+Message)
subplot(3,1,3);
plot(t,am);
xlabel('Time');
ylabel('Amplitude');
title('AM Signal');
grid on;

%%%%%%%%%%%% END %%%%%%%%%%%55

Enter the amplitude of message signal - :  2
Enter the Message frequency - :  5
Enter the Carrier frequency - :  100
Modulation Index - : 0.5


Download Project for B.E, B.Tech, BCA, MCA, M.E, M.Tech, B.Sc, M.Sc and Polytechnic


Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile / WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Contact Form

Name

Email *

Message *

Archive

Notes Planet Copyright 2018. Powered by Blogger.