You are on page 1of 4

%************ TASK 1 ***********%

clc

clear all

close all

a=[1 2 3 3; 4 5 6 6; 7 8 9 9; 4 4 4 4]

a_trans=a'

a_sum=sum(a)'

diag_a=diag(a)

sum_diag=sum(diag(a))

a(1,4)

element_sum=a(1,2)+a(3,4)

cancatination=[a a+32;a+48 a+16]

x=a

a(:,3)=[]

row_matrix=[1 2 3 4 5 6]

column_matrix=[1;2;3;4;5;6]

%************ TASK 2 ***********%

figure(1)

x=0:pi/100:2*pi

y=sin(x)

plot(x,y)

xlabel('x=0:2*pi')

ylabel('sin(x)')

title('Plot of sin function','fontsize',12)


%*****************%

figure(2)

x=0:pi/100:2*pi

y1=sin(x)

y2=sin(x-.25)

y3=sin(x-.5)

plot(x,y1,x,y2,x,y3)

legend('sin(x)','sin(x-.25)','sin(x-.5)')

grid on

title('Plot of sin function','fontsize',12)

figure(3)

%****************%

plot(x,y1,'r')

plot(x,y2,'g')

plot(x,y3,'*')

%*****************%

figure(4)

x1=0:pi/100:2*pi

x2=0:pi/10:2*pi

plot(x1,sin(x),'r:',x2,sin(x2),'r+')
%*****************%

figure(5)

x1=0:pi/100:2*pi;

y1=sin(x1)

y2=sin(2.5*x1)

y3=sin(5*x1)

y4=sin(7.5*x1)

subplot(2,2,1)

plot(x1,y1)

xlabel('radians')

ylabel('sin of x')

subplot(2,2,2)

plot(x1,y2)

xlabel('radians')

ylabel('sin of 2.5*x')

subplot(2,2,3)

plot(x1,y3)

xlabel('radians')

ylabel('sin of 5*x')

subplot(2,2,4)

plot(x1,y4)

xlabel('radians')

ylabel('sin of 7.5*x')

%********** TASK # 3 ****************%


figure(6)

t=0:5

y=exp(sin(5*t))+(cos(6*t)).*(sin(4*t))

plot(t,y,'b')

xlabel('time')

ylabel('sum of exponential functions')

title('plot of sum of di

You might also like