Friday, September 11, 2015

Homework 4 finally caught up XD

%(a) Use the provided data to calculate the stress 
%and the corresponding strain for each data pair. 
%The tested sample was a rod of diameter 0.505 in., 
%so you’ll need to find the cross-sectional area to use 
%in your calculations.
clear;clc
%the following varible has the values of force
F=[0 1650 3400 5200 6850 7750 8650 9300 10100 10400];
%and this variable has the values of length used to find strain
e=[2 2.002 2.004 2.006 2.008 2.010 2.020 2.040 2.080 2.120];
% using the strain fuction to calulate the stress from the force values
x=stress(F);
% and now the strain function
y=strain(e);
%now we plot with title and lable for the axis
plot(y,x,'k-')
xlabel('Strain')
ylabel('Stress, lb/in2')
title('Stress Vs Strain')

















%%
clear;clc
%(a) Create a “flower” with three petals.
theta = 0:0.01:pi;
rho = sin(3*theta);
%polar graph
figure
polar(theta,rho,'r--');
hold on;

%(b) Overlay your figure with eight additional petals, half the size of the three original ones.
theta2 = 0:0.01:2*pi;
rho2 = (sin(4*theta2))/2;
polar(theta2,rho2,'m-');
hold off

%(c) Create a heart shape.
figure(2)
t=0:0.01:2*pi;%theta from 0 to 2 pi
r=3*sin(t)+2*abs(cos(t)).^0.6-2.5-1.5*cos(2*t);%rho
polar(t,r,'r-');
%(d) Create a six-pointed star.
figure (3)
% need to create two triangles ontop of the same graph
thet = pi/6:(2/3)*pi:4*pi;
rh= ones(1,6);
polar(thet,rh)
hold on;
thet = pi/6:(2/3)*pi:4*pi;
rh= ones(1,6);
polar(-thet,rh)
%creat a hexagon
figure (4)
close
sides=6;
degrees=2*pi/sides ;
theta=0:degrees:360-degrees ;
radius=ones(1,numel(theta)) ;
















polar(theta,radius)
%%
clear;clc
%(a) Letting t = 0 represent the year 1965 and t = 50 represent 2015, use
%this model to calculate the predicted number of transistors per square
%inch for the 50 years from 1965 to 2015. Let t increase in increments of 2
% years. Display the results in a table with two columns—one for the year
% and one for the number of transistors.
t=0:2:50;%t stands for time, in this case years
d=Moore(t);% d is for density made from a function
t=transpose(t);% table friendly
d=transpose(d);% table friendly
T=table(t,d)% table


%(b) Using the subplot feature, plot the data in a linear x – y plot, a
%semilog x plot, a semilog y plot, and a log–log plot. Be sure to title the
% plots and label the axes.
%linear
subplot(2,2,1);
plot (t,d);
xlabel('Time in Years');
ylabel('Density');
title('Moores Law linear');
subplot(2,2,2);
%semilogx
semilogx(t,d);
xlabel('Log Time in Years');
ylabel('Density');
title('Moores Law semilogx');
subplot(2,2,3);
%semilogy
semilogy(t,d);
xlabel('Time in Years');
ylabel('Log Density');
title('Moores Law semilogy');
subplot(2,2,4);
%loglog
loglog(t,d);
xlabel('Log Time in Years');
ylabel('Log Density');
title('Moores Law Loglog');
%(c) The total transistor count on integrated circuits produced over the
%last 35 years is shown in the table at right. Create a semilog plot (with
%the y -axis scaled logarithmically) of the actual data, using circles only
%to indicate the data points (no lines). Include a second line representing
%the predicted values using Moore’s law, based on the 1971 count as the
% starting point. Add a legend to your plot.
figure (2)
t=[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];
d=[2300 2500 4500 29000 134000 275000 1200000 3100000 4300000 7500000 8800000 9500000 21300000 22000000 42000000 54300000 105900000 220000000 592000000 241000000 291000000 582000000 681000000 789000000 170000000 200000000 230000000 260000000];
semilogy(t,d,'or')
xlabel('Years');
ylabel('Log Values of Density');
title('Theoretical Moores and experimental Vs Time');
hold on
t=1971:2011;
d=Moore(0:40);
semilogy(t,d,'k-');
legend('Experimental','Theoretical Law');

No comments:

Post a Comment