Thursday, September 10, 2015

Day 4 - Importing Data into Matlab

Day 4:
We started with learning how to type into Matlab sin and cosine function and learned how to switch between radians and degrees.

We then did example with an air balloon and their forces. Here is a picture.

We then move on to commands that allowed us to sort data, which was later used for the weather example for precipitation. Here is a picture.


Conclusion:
We learned how use sin and cosine, switch between radians and degrees. Learned how to sort large data and find the mean, mode, and average. We also got a better understanding of how to manipulate a matrix to sort the data from high to low, to select a particular column and other things.


%HMWK 4 -1 **Code**

F = [0,1650,3400,5200,6850,7750,8650,9300,10100,10400]
l = [2,2.002,2.004,2.006,2.008,2.010,2.020,2.040,2.080,2.120]
lnot = 2

A = pi*(0.505/2)^2
sig = F/A
strain = (l - lnot)/lnot
plot(strain',sig', '-ok'), title('Stress V Strain'),xlabel('sigma' ),
ylabel('strain'),text(.004,4.5e4,'Yield P')
% 5 - 2
x = [0:.05:2*pi]
t = [0:.05:2*pi]
y1 = sin(x),y2 = cos(x),r1 = cos(t*3)
polar(x,r1,'--r'),title('3 petal'),xlabel('x'),ylabel('y')
hold on
x = [0:.05:2*pi]
t = [0:.05:2*pi]
y1 = sin(x),y2 = cos(x),r1 = .5*cos(t*4)
polar(x,r1,'--m'),title('graph 1'),xlabel('x'),ylabel('y')
%
clear,clc
x = [0:.05:2*pi]
t = [0:.05:2*pi]
r3= 1-1*sin(t)
polar(x,r3,'--m'),title('graph 1'),xlabel('x'),ylabel('y')
%
theta= 0:pi/3:2*pi
r= ones(1,7)
polar(theta,r)
r4 = sin(t*(pi/2)-(pi/2))
polar(theta,r),title('graph 1'),xlabel('x'),ylabel('y')
%
theta = [pi/6:(2/3)*pi:4*pi]
r= ones(1,6)
polar(theta,r)
hold on
theta = [pi/6:(2/3)*pi:4*pi]
r= ones(1,6)
polar(-theta,r)

%5-3
t=0:2:50
y = [2300 2500 4500 29000 134000 275000 1200000 3100000 4300000 7500000 8800000 9500000 21300000 22000000 42000000 54300000 105900000 220000000 592000000 241000000 291000000 582000000 681000000 789000000 1700000000 2000000000 2300000000 2600000000]
y= y'
ye = [1971 1972 1974 1979 1982 1985 1989 1993 1996 1997 1997 1999 1999 1999 2000 2003 2003 2003 2004 2006 2006 2006 2006 2007 2006 2008 2010 2011]
x = 1965:2:2015
dt = 30*2.^(t/2)

subplot(2,2,1)
plot(x,dt),title('graph 1'),xlabel('year'),ylabel('trans')
subplot(2,2,2)
semilogx(x,dt), title('graph 2'),xlabel('year'),ylabel('trans')
subplot(2,2,3)
semilogy(x,dt), title('graph 3'),xlabel('year'),ylabel('trans')
subplot(2,2,4)
loglog(x,dt), title('graph 4'),xlabel('year'),ylabel('trans')
figure
subplot(2,2,1)
plot(x,dt), title('graph 1'),xlabel('year'),ylabel('trans')
subplot(2,2,2)
semilogx(x,dt), title('graph 2'),xlabel('year'),ylabel('trans')
subplot(2,2,3)
semilogy(x,dt), title('graph 3'),xlabel('year'),ylabel('trans')
subplot(2,2,4)
loglog(x,dt), title('graph 4'),xlabel('year'),ylabel('trans')
%plot(x,y, '-ok'), title('Stress V Strain'),xlabel('sigma' ),
%ylabel('strain'),text(.004,4.5e4,'Yield P')
figure

semilogy(ye,y, 'ok',x,dt), title('moore law'),xlabel('year' ),
ylabel('trans')
legend(20,20,'real','expermintal')

*********picture of homework checked*********




No comments:

Post a Comment