Sei sulla pagina 1di 6

Matlab Assignments:

Assignment 1:
Adding to sin waves:
CODE:
% Defining time

time=0:0.001:0.06;

%defining first sin wave

a=1*sin(2*pi*200)*time;

subplot(311);

plot(time,a);

%defining second sin wave

b=1*sin((2*pi*300)*time);

subplot(312);

%Adding the two waves

u=a+b;

subplot(313);

%plotting the waves

plot(time,u);
OUTPUT:

Assignment 2:
Image Processing:
%% Defining an integer
i=imread('nature.jpg');
imshow(i);
%% Resize the image
S=imresize(i,[300 300]);
figure
imshow(S);
%% Changing color of image into Black and white
blackwhite=rgb2gray(S);
figure
%% Displaying both two waves
subplot (121),imshow(S),title('colored nature');
suplot(122),imshow(blackwhite,title(blackwhite nature');

OUTPUT:

Assignment 3:
Plot the graph using exponential
function:
y=[0.5,1,1.5];
for a=1:3;
Q=1;
y=(n);
t=0.40;
i=Q*exp(-y^t);
subplot(3,1,a);
plot(t,1)
end

OUTPUT:
Assignment 4:
fs=5000;
dt=1/fs;
t=0:dt:0.01;
f=200;
x=sin(2*pi*f*t)/2;
figure;
subplot(212);
stem(t,x,'filled','r');
sound(x,fs);
Output:

Potrebbero piacerti anche