Thursday, December 10, 2015
3rd and final Project
The Project's Final Form, a beast in its own right as long as the code works out which was set into motion the day the project was due. For something that seemed relatively easy to program, this project took over 36 hours of coding alone so our data was not the most reliable seeing as how the temperature probe did not record the correct temp during the entire process.
My contributions varied far and vast for this project, and while most of my coding was ultimately thrown to the wayside, it was the foundation for what we got at the end. Though to be fair it was mostly just suggestions for how to code the project instead of me being the one at the computer. I guess I have some issue using someone else's computer.
As far as design and construction, I made suggestions for how the incubator should be built, though few were taken I did manage to force some ideas into the final project but mostly the design was jointly agreed upon from the start. Construction was done in tandem so we can share the credit on that nonsense.
Now here's where most of my contribution really shines is the presentation. While the ideas were created by the both of us, I was the one who created the powerpoint. Every graphic, animation, sound effect, everything was implemented by me, with consent though. I'm not the type of person who would spring these amazing presenting powers on my partner when they first see it.
The initial design of our incubator, made while I was sick mind you, at the brewery that I work at no less.
Matlab home work 15
Contents
PROBLEM #1
clear,clc x = linspace(-1,1,11); y = x.^5 + 2*x.^2 - x + 3; int_trap = trapz(x,y) int_quad = quad('x.^5 + 2*x.^2 - x + 3',-1,1) int_quadl = quadl('x.^5 + 2*x.^2 - x + 3',-1,1)
int_trap =
7.3600
int_quad =
7.3333
int_quadl =
7.3333
PROBLEM #2
clear,clc
syms y(t)
y(t) = dsolve(diff(y,t) == t^2 +y, y(0) == 0)
Y = subs(y(t),t,[0,1])
y(t) = 2*exp(t) - 2*t - t^2 - 2 Y = [ 0, 2*exp(1) - 5]
PROBLEM #3
clear,clc syms f(x) h1 h2 h3 h1(x) = f h2(x) = diff(f,x) h3(x) = diff(f,x,2) V = odeToVectorField(2*diff(f,3) == -f*diff(f,2)) M = matlabFunction(V,'vars',{'x','Y'}) sol = ode45(M,[0,1],1)
h1(x) =
f(x)
h2(x) =
diff(f(x), x)
h3(x) =
diff(f(x), x, x)
V =
Y[2]
Y[3]
-(Y[1]*Y[3])/2
M =
@(x,Y)[Y(2);Y(3);Y(1).*Y(3).*(-1.0./2.0)]
Index exceeds matrix dimensions.
Error in symengine>makeFhandle/@(x,Y)[Y(2);Y(3);Y(1).*Y(3).*(-1.0./2.0)]
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in Homework15 (line 28)
sol = ode45(M,[0,1],1)
matlab homework 14
Contents
Problem #1 - Interpolation
clear,clc V = [1 2 3 4 5 6]; P = [2494 1247 831 623 499 416]; Linear_P = interp1(V,P,3.8) Spline_P = interp1(V,P,3.8,'spline') Linear_V = interp1(P,V,1000) Linear_V = interp1(P,V,1000,'spline')
Linear_P =
664.6000
Spline_P =
657.4373
Linear_V =
2.5938
Linear_V =
2.4779
Problem #2 - Curve Fitting
clear,clc V = [1 2 3 4 5 6]; P = [2494 1247 831 623 499 416]; %polyfit gives you the coefficients. %polyval plugs in values for 'x' and solves for each. Y1 = polyval(polyfit(V,P,1),V); Y2 = polyval(polyfit(V,P,2),V); Y3 = polyval(polyfit(V,P,3),V); Y4 = polyval(polyfit(V,P,4),V); plot(Y1) hold on plot(Y2) plot(Y3) plot(Y4) plot(V,P,'o') new_V = 1:0.2:6; %higher data precision for V int_P = interp1(V,P,new_V); %interpolate in order to get values in between V's plot(new_V,int_P,'g') legend('1st Order','2nd Order','3rd Order','4th Order','Actual','Interpolated') title('Pressure vs. Volume') xlabel('Volume (m^3)') ylabel('Pressure (kPa)') % 4th order polynomial seems to do the best job of fitting the data

Problem #3 - Curve Fitting II
clear,clc V = [1 2 3 4 5 6]; P = [2494 1247 831 623 499 416]; Y = polyfit(1./V,P,1) T = Y(1)/8.314 new_V = 1./V; plot(new_V,P) title('Pressure vs. Inverse Volume') xlabel('1/V (m^-3)') ylabel('Pressure (kPa)')
Y =
1.0e+03 *
2.4940 -0.0000
T =
299.9715

Matlab homework13
Contents
% % PROBLEM #1 syms f m g L l Y = sym('2*pi*f = sqrt(m*g*L/l)') solve(Y,L)
Y = 2*pi*f == ((L*g*m)/l)^(1/2) ans = (4*pi^2*f^2*l)/(g*m)
PROBLEM #2
clear,clc syms v0 theta t g X = v0*t*cos(theta) Y = v0*t*sin(theta)-0.5*g*t^2 dX = subs(X,{t,v0,theta},{[0:20],100,pi/4}) dY = subs(Y,{t,v0,theta,g},{[0:20],100,pi/4,9.8}) ezplot(dX) hold on ezplot(dY)
X = t*v0*cos(theta) Y = t*v0*sin(theta) - (g*t^2)/2 dX = [ 0, 50*2^(1/2), 100*2^(1/2), 150*2^(1/2), 200*2^(1/2), 250*2^(1/2), 300*2^(1/2), 350*2^(1/2), 400*2^(1/2), 450*2^(1/2), 500*2^(1/2), 550*2^(1/2), 600*2^(1/2), 650*2^(1/2), 700*2^(1/2), 750*2^(1/2), 800*2^(1/2), 850*2^(1/2), 900*2^(1/2), 950*2^(1/2), 1000*2^(1/2)] dY = [ 0, 50*2^(1/2) - 49/10, 100*2^(1/2) - 98/5, 150*2^(1/2) - 441/10, 200*2^(1/2) - 392/5, 250*2^(1/2) - 245/2, 300*2^(1/2) - 882/5, 350*2^(1/2) - 2401/10, 400*2^(1/2) - 1568/5, 450*2^(1/2) - 3969/10, 500*2^(1/2) - 490, 550*2^(1/2) - 5929/10, 600*2^(1/2) - 3528/5, 650*2^(1/2) - 8281/10, 700*2^(1/2) - 4802/5, 750*2^(1/2) - 2205/2, 800*2^(1/2) - 6272/5, 850*2^(1/2) - 14161/10, 900*2^(1/2) - 7938/5, 950*2^(1/2) - 17689/10, 1000*2^(1/2) - 1960]
Error using inlineeval (line 14)
Error in inline expression ==> matrix([[0, 50.*2.^(1./2), 100.*2.^(1./2), 150.*2.^(1./2), 200.*2.^(1./2), 250.*2.^(1./2), 300.*2.^(1./2), 350.*2.^(1./2), 400.*2.^(1./2), 450.*2.^(1./2), 500.*2.^(1./2), 550.*2.^(1./2), 600.*2.^(1./2), 650.*2.^(1./2), 700.*2.^(1./2), 750.*2.^(1./2), 800.*2.^(1./2), 850.*2.^(1./2), 900.*2.^(1./2), 950.*2.^(1./2), 1000.*2.^(1./2)]])
Undefined function 'matrix' for input arguments of type 'double'.
Error in inline/feval (line 33)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ezplotfeval (line 51)
z = feval(f,x(1));
Error in ezplot1ezplot1 (line 472)
[y, f, loopflag] = ezplotfeval(f, x);
Error in ezplot (line 144)
[hp, cax] = ezplot1(cax, f{1}, vars, labels, args{:});
Error in sym/ezplot (line 61)
h = ezplot(fhandle(f));
Error in Homework13 (line 18)
ezplot(dX)
PROBLEM #3
clear,clc syms t H = -0.12*t^4 + 12*t^3 - 380*t^2 + 4100*t + 220 V = diff(H,t) A = diff(V,t) time = double(solve(H,t)) subplot(3,1,1) ezplot(H,[0,52]) title('Height vs time') ylabel('Height') xlabel('Time') subplot(3,1,2) ezplot(V,[0,52]) title('Velocity vs time') ylabel('Velocity') xlabel('Time') subplot(3,1,3) ezplot(A,[0,52]) title('Acceleration vs time') ylabel('Acceleration') xlabel('Time') time1 = solve(V,t) height = double(subs(H,t,time1)); max_height = real(double(max(height)))
PROBLEM #4
clear,clc syms x n F = sym('20*x') W = int(F,'0','n-1') W2 = subs(W,'n','2') W3 = max(double(solve('25 = 10*(n-1)^2')))
PROBLEM #5
clear,clc
A = sym('tan(x)')
int_A = int(A)
ezplot(int_A,[-5,5])
MatLAB home Work 12
Contents
PROBLEM 1
clear,clc syms x X ex1 = x^2-1; EX1 = sym('X^2-1'); eq1 = sym('x^2 = 1'); EQ1 = sym('X^2 = 1'); one = subs(ex1,x,4) two = subs(EX1,X,4) three = subs(eq1,x,4) four = subs(EQ1,X,4) % one = 15 % two = 15 % three = 16==1 % four = 16==1
one = 15 two = 15 three = 16 == 1 four = 16 == 1
PROBLEM 2
V = 0:2:10; V1 = subs(ex1,x,V) V2 = subs(EX1,X,V) V3 = subs(eq1,x,V) V4 = subs(EQ1,X,V) % This works for the V1 and V2, which have whole intergers place inside % their vecotrs. For V3 and V4, each vector component is an equality of two % numbers that don't make any sense.
V1 = [ -1, 3, 15, 35, 63, 99] V2 = [ -1, 3, 15, 35, 63, 99] V3 = [ 0 == 1, 4 == 1, 16 == 1, 36 == 1, 64 == 1, 100 == 1] V4 = [ 0 == 1, 4 == 1, 16 == 1, 36 == 1, 64 == 1, 100 == 1]
PROBLEM 3
clear,clc syms a b c A B C x X ex4 = a*x^2 + b*x + c; EX4 = sym('A*X^2 + B*X +C'); eq4 = sym('a*x^2 + b*x + c = 0'); EQ4 = sym('A*X^2 + B*X + C = 0'); x_ex = subs(ex4,{a b c x},{3 4 5 [0:0.5:5]}) X_EX = subs(EX4,{A B C X},{3 4 5 [0:0.5:5]}) x_eq = subs(eq4,{a b c x},{3 4 5 [0:0.5:5]}) X_EQ = subs(EQ4,{A B C X},{3 4 5 [0:0.5:5]}) % all results are symbolic
x_ex = [ 5, 31/4, 12, 71/4, 25, 135/4, 44, 223/4, 69, 335/4, 100] X_EX = [ 5, 31/4, 12, 71/4, 25, 135/4, 44, 223/4, 69, 335/4, 100] x_eq = [ 5 == 0, 31/4 == 0, 12 == 0, 71/4 == 0, 25 == 0, 135/4 == 0, 44 == 0, 223/4 == 0, 69 == 0, 335/4 == 0, 100 == 0] X_EQ = [ 5 == 0, 31/4 == 0, 12 == 0, 71/4 == 0, 25 == 0, 135/4 == 0, 44 == 0, 223/4 == 0, 69 == 0, 335/4 == 0, 100 == 0]
PROBLEM 4
clear,clc syms f m g L I Y = sym('((2*pi)*f = sqrt((m*g*L)/I))') L = solve(Y,L)
Y = 2*pi*f == (-L*g*m*1i)^(1/2) L = (pi^2*f^2*4i)/(g*m)
PROBLEM 5
clear,clc syms mt mb x water = sym('50 = 0.2*mt + 0.65*mb'); ethanol = sym('0 = -100*x + 0.35*mt + 0.25*mb'); methanol = sym('50 = 100*x + 0.45*mt + 0.1*mb'); [x,mass_top,mass_bottom] = solve([water,ethanol,methanol],[x,mt,mb])
x = 0.28333333333333333333333333333333 mass_top = 33.333333333333333333333333333333 mass_bottom = 66.666666666666666666666666666667
night rider program
Labview Lecture november 24
So These pictures might not particularly be from the same lecture or from the 24 at all but that's not the point because the first picture has a stepper motor and that's what this entry is all about anyway. It is what allows for two devices to be run at the same time, at opposite times, or not at all as it opens/closes circuits based on programming, the bottom picture looks more like a relay but whatever.
A stepper motor is an electric motor that rotates in discrete step increments. The movement of each step is precise and repeatable; therefore the motor's position can be controlled precisely without any feedback mechanism, as long as the motor is carefully sized to the application.
There are two common winding arrangements for the electromagnetic coils: bipolar and unipolar. The described stepping sequence utilizes the bipolar winding. Each phase consists of a single winding. By reversing the current in the windings, electromagnetic polarity is reversed. A unipolar stepper motor has one winding with center tap per phase. Each section of windings is switched on for each direction of magnetic field.
LabVIEW Lecture november 19
DC motors
oh dc you might be a shoe company, and also the last half of one of the best Australian bands to have existed, but before all that you were a contraction of the words direct current.
Motors are used to convert electrical energy to mechanical energy (in this case, rotation). Most DC motors have six basic parts: an armature or rotor, commutator, brushes, axle, field magnet, and stator. The stator is the stationary part of the motor, which includes the motor casing and two field (permanent) magnets. The rotor (which includes the axle and commutator) is an electromagnet that rotates with respect to the stator. The windings on the rotor make an electrical connection to the power source through the brushes and the commutator.When a current flows through the rotor windings, a magnetic field is created. The rotor experiences a torque caused by the permanent magnets in the stator causing the rotor to rotate.
This particular day we used two components of vernier, digital components by the way, to make a tachometer (A tachometer is an instrument that measures the rotational speed of a motor’s shaft in revolutions per minute (rpm).) for a fan that we used before. So we go the programming done for the fan already which was easy because it just needs to have power run through it. The fan will be running at full speed because we have yet to cover the duty cycle of a motor. So to measure the rpm we need to know how fast the blades spin, to do that there's this photogate that measures when a laser is broken(by the fan blades in this case) a program is then written to take into account how many blades there are to determine how fast the fan rotates at.
oh dc you might be a shoe company, and also the last half of one of the best Australian bands to have existed, but before all that you were a contraction of the words direct current.
Motors are used to convert electrical energy to mechanical energy (in this case, rotation). Most DC motors have six basic parts: an armature or rotor, commutator, brushes, axle, field magnet, and stator. The stator is the stationary part of the motor, which includes the motor casing and two field (permanent) magnets. The rotor (which includes the axle and commutator) is an electromagnet that rotates with respect to the stator. The windings on the rotor make an electrical connection to the power source through the brushes and the commutator.When a current flows through the rotor windings, a magnetic field is created. The rotor experiences a torque caused by the permanent magnets in the stator causing the rotor to rotate.
This particular day we used two components of vernier, digital components by the way, to make a tachometer (A tachometer is an instrument that measures the rotational speed of a motor’s shaft in revolutions per minute (rpm).) for a fan that we used before. So we go the programming done for the fan already which was easy because it just needs to have power run through it. The fan will be running at full speed because we have yet to cover the duty cycle of a motor. So to measure the rpm we need to know how fast the blades spin, to do that there's this photogate that measures when a laser is broken(by the fan blades in this case) a program is then written to take into account how many blades there are to determine how fast the fan rotates at.
labVIEW lecture november 12
Above Threshold Warning for Incubating Chickens:
The dreaded prelude to one of the most frustrating, yet rewarding projects that I have done.
I won't have any pictures of code for this blog, I am sorry to disappoint you however if you happen upon Chris Cote's blog somewhere around November 12 there is a good chance you will see the code and such that I worked on.
These goddamn chickens are so finicky with their temperature preferences. Put a damn coat on for christsake, or take it off, whatever. But noooooo, we go about making this wholely unnecessary thermometer that responds with 4 temperture gauges so that we can see via LabVIEW interface and then again on the incubating device itself. This is the first, or one of the many first times we used Labview vernier's analog port for temperature. There's this entire deal with finding the function table in the back panel and then setting it up in a correct way not to mention we introduce case structures, pretty cool initially but they get annoying, to output degrees in Celsius or in Fahrenheit and finally there is a message that says, when a condition is met or not met, what state is above or at threshold.
all of this is used in that future prpoject as we were supp0ose to keep a device within a certain heat range.
The dreaded prelude to one of the most frustrating, yet rewarding projects that I have done.
I won't have any pictures of code for this blog, I am sorry to disappoint you however if you happen upon Chris Cote's blog somewhere around November 12 there is a good chance you will see the code and such that I worked on.
These goddamn chickens are so finicky with their temperature preferences. Put a damn coat on for christsake, or take it off, whatever. But noooooo, we go about making this wholely unnecessary thermometer that responds with 4 temperture gauges so that we can see via LabVIEW interface and then again on the incubating device itself. This is the first, or one of the many first times we used Labview vernier's analog port for temperature. There's this entire deal with finding the function table in the back panel and then setting it up in a correct way not to mention we introduce case structures, pretty cool initially but they get annoying, to output degrees in Celsius or in Fahrenheit and finally there is a message that says, when a condition is met or not met, what state is above or at threshold.
all of this is used in that future prpoject as we were supp0ose to keep a device within a certain heat range.
LabVIEW Lecture November 10
Review Case structures:
What do they do, basically if/else if code. Lets you select between a specific set of operations depending on an initial condition. An Enum control allow the user to select between options, Ring can also be used. This two allow for more than two cases.
Sequence Structure:
When functions need to be done in a specific order. Forces orders to be done in a certain order. Found in Functions Palette / Programming Group / Structures Group / Flat /Sequence Structure
MAtlab script:
You can type directly in matlab code and import the Labview code into matLAB under:
Functions Palette / Mathematics / Scripts and Formulas / Script Nodes / MATLAB Script
This specific script is not in the apple version of labVIEW evaluation but had it been it would be advised to change the data types of the outputs that are used in the matLab code other wise an intended array wi;ll out put only one number.
Boolean Functions
Functions Comment
And AND
Boolean To (0,1) Converts FALSE, TRUE to 0,1
Compound Arithmetic Performs certain math operation (Add, Multiply, AND, OR or XOR) on more than two values
Exclusive Or XOR
False Constant Returns FALSE
Not and NAND
Not Exclusive Or NOT XOR
Not Or NOR
Not NOT
Or OR
True Constant Returns TRUE
Cylindrical tank problem:
HARDWARE:
Hooking computer up to an interface. My God, looking at that example program from the example download is very complex.
Ok by this point I might not have had Labview to run on my computer just yet so it is mostly me just working from the notes, that or we switched to the vernier part of LabVIEW and that never ran on my own computer, if we are at the former point I would like to mention that all of the Homework from this point on was completed with one or more classmates since I could not run anything myself good for me because it let me see how other people went around doing their programing and gave me insight on how to work out multiple solutions to one problem.
What do they do, basically if/else if code. Lets you select between a specific set of operations depending on an initial condition. An Enum control allow the user to select between options, Ring can also be used. This two allow for more than two cases.
Sequence Structure:
When functions need to be done in a specific order. Forces orders to be done in a certain order. Found in Functions Palette / Programming Group / Structures Group / Flat /Sequence Structure
MAtlab script:
You can type directly in matlab code and import the Labview code into matLAB under:
Functions Palette / Mathematics / Scripts and Formulas / Script Nodes / MATLAB Script
This specific script is not in the apple version of labVIEW evaluation but had it been it would be advised to change the data types of the outputs that are used in the matLab code other wise an intended array wi;ll out put only one number.
Boolean Functions
Functions Comment
And AND
Boolean To (0,1) Converts FALSE, TRUE to 0,1
Compound Arithmetic Performs certain math operation (Add, Multiply, AND, OR or XOR) on more than two values
Exclusive Or XOR
False Constant Returns FALSE
Not and NAND
Not Exclusive Or NOT XOR
Not Or NOR
Not NOT
Or OR
True Constant Returns TRUE
Cylindrical tank problem:
HARDWARE:
Hooking computer up to an interface. My God, looking at that example program from the example download is very complex.
Ok by this point I might not have had Labview to run on my computer just yet so it is mostly me just working from the notes, that or we switched to the vernier part of LabVIEW and that never ran on my own computer, if we are at the former point I would like to mention that all of the Homework from this point on was completed with one or more classmates since I could not run anything myself good for me because it let me see how other people went around doing their programing and gave me insight on how to work out multiple solutions to one problem.
some lecture in october probably
One of those 5 step problems with the whole: Question, inputs and out puts, assumptions, hand example, then coding, comparing
jist to it.
I do recall this lesson, and in fact have some rather good commentary to it. So lets get started then
As you can see from the above picture, the polyfit and polyval function have been introduced. These are ideal for making mathematical models and for putting the equations to the math models on the graph. The final for this class had some similar question being asked of us (that is the students of the class). Any butt you couldn't use this for a 3-d plot/ set of data because matLab doesn't know how to come up with a 3 variable dependent polyfit equation. Go figure.
And another great, probably would have worked in the best case scenario on the final, use of matlab known as interpolation or interpolated spline which has matlab make a guess of where to put a piece of data that is in between data points of an already declared function. Super useful as the user inputs this little baby and then doesn't even have to make a math model for the new data points to be integrated into the data that was originally in the noninterpolated data. This picture shows 3 variable while the following shows the same code with 2 so they are more than likely in the wrong order but who cares.Lecture October 8
Now I cant be too entirely sure what this lecture was completely about. There seem to be quite a few pictures that relate to the class and size of my work space variables so I must assume that we had just gone over the very basics of computer science. But then again this was over 2 months ago and I do not have the best of memories. None the less this was a daft that I just prefer to make into a post. I'm sure that it would be relatively easy to look back on this particular entry and find something useful that I might be able to use. For instance the int8 function lets me make the integer into a smaller size data entry which runs through programs faster than a double. There was also some input with cells and cell arrays which is pretty useful stuff if I do say so myself.
one of the most useful pictures was the circuit program towards the top. I can see myself using this program in physics 4B or even engineering 44. and you might have thought real world application was beyond this class, shame on you, SHAME!
Tuesday, November 17, 2015
Labview Lecture November 17
Difference between digital inputs is that the circuit is involved with a switch. In this way there is an all or nothing indicator that tells the device if it is reading or not. Analogue usually has a variable acting as a resistor input that changes the voltage that is read to display what is being recorded. with a 3.3V system it still works with the 5V system because the digital 1 is 2.6 and above and the digital 0 is 2.5 and below, effectively creating a binary system. Resistors are used to preserve the technology in the micro controller and the LED.
Voltage drop in LEDs are associated with their color. Current determines the brightness though a current that is too strong burn out the lights. With the help of transistors or relays, digital outputs also control other more advanced electrical devices.
Review of binary:
numbers represent base 2 and the final answer is equal to the addition of each.
ex) 100 = 2^2*1+2^1*0+2^0*0=4
With 4 digital outputs you can have 16 options for what can be output.
BTD-British Telecom Digital (Left hand side plug)
Voltage drop in LEDs are associated with their color. Current determines the brightness though a current that is too strong burn out the lights. With the help of transistors or relays, digital outputs also control other more advanced electrical devices.
Review of binary:
numbers represent base 2 and the final answer is equal to the addition of each.
ex) 100 = 2^2*1+2^1*0+2^0*0=4
With 4 digital outputs you can have 16 options for what can be output.
BTD-British Telecom Digital (Left hand side plug)
|
POS.
|
DEFAULT
|
|
|
|
COLOR
|
NOTE
|
||
|
|
|
||
|
Pin1
|
DIO0
|
YELLOW
|
3.3V or 5V High
|
|
Pin2
|
DIO1
|
BLACK
|
|
|
Pin3
|
DIO2
|
GREEN
|
|
|
Pin4
|
PWR
(5.3V)
|
WHITE or BROWN
|
|
|
Pin5
|
GND
|
ORANGE
|
|
|
Pin6
|
DIO3
|
RED
|
|
A relay is nothing more than a switch. A relay is an
electromechanical switch. Simply put, a relay will be used
for an alarm or remote start installation for one or more of
the four purposes:
o To turn something ON
o To turn something OFF or disable something o To change the polarity of a wire
o To increase the current supply of a wire.
o To turn something ON
o To turn something OFF or disable something o To change the polarity of a wire
o To increase the current supply of a wire.
Subscribe to:
Posts (Atom)
















