Professional Documents
Culture Documents
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)
x=a
a(:,3)=[]
row_matrix=[1 2 3 4 5 6]
column_matrix=[1;2;3;4;5;6]
figure(1)
x=0:pi/100:2*pi
y=sin(x)
plot(x,y)
xlabel('x=0:2*pi')
ylabel('sin(x)')
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
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')
t=0:5
y=exp(sin(5*t))+(cos(6*t)).*(sin(4*t))
plot(t,y,'b')
xlabel('time')
title('plot of sum of di