Matlab Code

From OpenWetWare
Jump to: navigation, search
clear all; close all;

%% constants and such
uo=4*pi*10^(-7);n=130;R=.15;

%% Constant Voltage Vary Current
VOLT=449.3;
rcurr=[3.25 	3.35 	3.70 	4.00 	3.5 	3.8 	4.35 	4.4 ]*10^-2;
curr=[2.491 	2.391 	2.291 	2.191 	2.09 	1.991 	1.891 	1.790];
error1=[.1 	.1 	.1 	.1 	.1 	.1 	.1 	.1 ]*10^-2;
qm1=((2.*VOLT.*R.^2)./(uo.^2.*n.^2.*curr.^2.*rcurr.^2)).*(5./4)^3
qmVOLT=mean(qm1)
sem1=std(qm1)/length(qm1)

%% Constant Current Vary Voltage
CURR=1.6;
rvolt=[3.7 	4.2 	4 	4.5 	4.3 	4.5 	4.5 	4.7 ]*10^-2;
volt=[355 	365.5 	375 	385.5 	395 	405 	415 	425 ];
error2=[.1 	.1 	.1 	.1 	.1 	.1 	.1 	.1 ]*10^-2;
qm2=((2.*volt.*R.^2)./(uo.^2.*n.^2.*CURR.^2.*rvolt.^2)).*(5./4)^3
qmCURR=mean(qm2)
sem2=std(qm2)/length(qm2)

%% Vary Current and Voltage
Volt3=[449.2 	421.1 	401.6 	390 	380.4 	395 	405.5 	415 ];
Current3=[1.292 	1.400 	1.503 	1.605 	1.7 	1.606 	1.506 	1.410 ];
r3=[4.3 	5.5 	4.4 	4 	3.75 	4 	4.5 	5.75 ]*10^-2;
qm3=((2.*Volt3.*R.^2)./(uo.^2.*n.^2.*Current3.^2.*r3.^2)).*(5./4)^3
qmvary=mean(qm3)
sem3=std(qm3)/length(qm3)

%% Find those errors

q=1.76e11

err1=((q-qmVOLT)/q)*100
err2=((q-qmCURR)/q)*100
err3=((q-qmvary)/q)*100