I hiked there over spring break, and it was a tiring but also a great experience.
Thursday, March 28, 2013
Hiking
Mt. Liberty in New Hampshire
I hiked there over spring break, and it was a tiring but also a great experience.
I hiked there over spring break, and it was a tiring but also a great experience.
Modeling & Simulation
We learned the basics of Matlab using the first four chapters of Allen Downey's Physical Modeling in MATLAB.
(Will add more screenshots soon...)
We had several assignments from the book:
(Will add more screenshots soon...)
We had several assignments from the book:
- Exercise 2.1: fibonacci1 script
- Exercise 2.3: car_update script
- Exercise 3.1: car_loop script
- Exercise 3.2: car_loop script with plotting. Also try initial values of a & b = 10000
- Exercise 3.5: fibonacci2 sequence script
- Exercise 4.6: plotting fibonacci ratios
- Experiment with the following simulation of the trajectory of a hit baseball. For what angle is the horizontal distance maximized?
-------------------------------------------------------------------------------------------------------------------------------------------------------------
For Exercise 2.1 , we broke down the Fibonacci term formula into smaller parts (by assigning variables to represent each part) to make the program easier to debug. We also allowed the user to enter the desired value of n (to determine the nth fibonacci number). I've read about and learned the very basics of Python and realized program languages can be different yet similar.
Exercises 2.3, 3.1, 3.2 combined: We were given two locations (Albany and Boston) and the rates of car movements (3% and 5% respectively). We used a for loop to continue the exchange until a certain number of weeks. (The user was able to type in his/her desired number of weeks.) Since the total number of cars was 20,000 (by the conservation of cars), we assigned b(i+1) as 20,000 - a(i+1).
Exercise 3.5: This was our second Fibonacci sequence assignment, where we had to use a for loop to compute the first 10 elements of the sequence. We allowed the user to enter the number of terms, so this program would work for any term of the sequence.
Exercise 4.6: This was our third Fibonacci sequence assignment, and here, this program computes a vector (X) with the first n elements of a Fibonacci sequence and then computes a new vector (R) that contains the ratios
of consecutive Fibonacci numbers. The user was able to enter the value of n. This was one of the more challenging programs to write because I found it challenging to create vectors (I really had to read and reread the section on vectors to better understand the concepts). We discovered that the value of convergence was about 1.618 (golden ratio).
Trajectory of a Hit Baseball
Program:
Although this was not the best method, I used the "trial and error" method. From physics, I had learned that 45 degrees would give the largest horizontal distance. However, using this program, 44 degrees gave a larger horizontal distance value than 45 degrees did. So, I substituted in different values (close to 45 degrees) for the angle and determined that the largest x(i) or the horizontal distance was 262.8410 (when angle = 45.5 degrees).
I will try to determine a better way to solve this program, perhaps by using some maximum function/tool.
Exercise 4.6: This was our third Fibonacci sequence assignment, and here, this program computes a vector (X) with the first n elements of a Fibonacci sequence and then computes a new vector (R) that contains the ratios
of consecutive Fibonacci numbers. The user was able to enter the value of n. This was one of the more challenging programs to write because I found it challenging to create vectors (I really had to read and reread the section on vectors to better understand the concepts). We discovered that the value of convergence was about 1.618 (golden ratio).
Trajectory of a Hit Baseball
Program:
% Model of trajectory of hit baseball. Assumes no air drag.
% What angle maximizes the distance travelled?
clf % clear the previous figure
hold on % allow plotting of multiple figures
angle = 30; % angle baseball hit, in degrees
velocity = 45.5 % initial velocity of baseball, in meters/sec
rads = angle * pi / 180;
velocity_x(1) = velocity * cos(rads); % horizontal velocity of baseball
velocity_y(1) = velocity * sin(rads); % vertical velocity of baseball
x(1) = 0; % x position of batter
y(1) = 1; % assume baseball hit 1 meter off ground
dt = 0.1; % time step for simulation, in seconds
g = 9.8; % gravitational constant, in meters/sec^2
i = 1 % iteration index
while y(i) > 0
x(i+1) = x(i) + velocity_x(i)*dt; % Update x position
y(i+1) = y(i) + velocity_y(i)*dt; % Update y position
velocity_y(i+1) = velocity_y(i) - g*dt; % y velocity changes due to gravity
velocity_x(i+1) = velocity_x(i); % x velocity doesn't change (assume no air drag)
plot(x(i), y(i), 'r.-'); % display a red dot for each point, and connect them with lines
i = i + 1; % change index for next iteration
end
x(i) % Display the final x value.
Although this was not the best method, I used the "trial and error" method. From physics, I had learned that 45 degrees would give the largest horizontal distance. However, using this program, 44 degrees gave a larger horizontal distance value than 45 degrees did. So, I substituted in different values (close to 45 degrees) for the angle and determined that the largest x(i) or the horizontal distance was 262.8410 (when angle = 45.5 degrees).
I will try to determine a better way to solve this program, perhaps by using some maximum function/tool.
Thursday, March 14, 2013
Dumplings
Getting Ready for Congo Line
3/13/2013 Wednesday
Tasks:
1.) Moving arm to a fixed point (vertical)
a.) It was not difficult to move the arm to a fixed point using bang/bang control, but bang/bang control did not let us re-locate the arm to a different place. The arm was stuck at the fixed point after one trial of moving the arm away from the point.
b.) Programming the proportional control required more thought and was more challenging, but the arm moved in smoother motions. We were also able to re-locate the arm away from the fixed point as many times as we wanted. *We let the fixed point be at 100 (which we checked using "forever" --> "print" --> "count a") to avoid worrying about negative numbers for the error.
We used the equation from last week: error = set point goal - actual reality (error = what we want - what we actually get). Another equation we considered was: change in power = gain x error. We were able to experiment and change the gain value to control the power and error. This allowed for smoother movements.
2.) Making one wheel follow another (using manual movement)
At first, we decided to manually move the arm connected to motor b to make sure the arm connected to motor a followed. Again, we used proportional control and used the error and power equations mentioned above.
Example: If b was more positive than a (the arm connected to motor b had a higher/more positive number than the arm connected to motor a), the error was the difference of arm b and arm a. We set the gain value as 7. Then, the program commanded arm a to move forward (FWD2) to arm b's position (count).
We then added "talk to b" --> "motor on" to make sure the wheel connected to motor b constantly ran (and the wheel connected to motor a would follow, causing the car to move in a straight or straighter line).
3.) We did not finish this task.
From Wednesday's class, I learned the advantages of using proportional control versus using bang/bang control, which is very limiting.
Wednesday, March 6, 2013
PicoBlocks: Pocahontas the Line-Follower
After working with Solidworks and the laser cutter for weeks, we began the feedback and control unit. Our challenge after spending some class time learning about the Pico Blocks software was to make the cyborg cars (already built for us) follow a white line-path using an LED light sensor.
Pocahontas, Our Cyborg Car
One of the first steps we took was using the number board (?) to see the numbers reported by the LED sensor. We found out that on the white line, the number was around 500-530, while the number for the cardboard was around 600. (The number for the edge of the white tape was 530-540.)
Julie, Julia, and I had a couple of different ideas on how Pocahontas could follow the white line. Our first idea was to have Pocahontas follow the right edge of the white tape then bear to the left whenever the car moved on to the cardboard. (The shape of the path was a hook, so we thought this would be possible.) However, we also thought of having Pocahontas "check" both directions (bearing right and left) to find the white line then move forward.
After hours of experimenting with the software, our program looked like this:
Our Pico Blocks Program
This program commanded Pocahontas to move forward if the LED sensor read numbers between 470 and 500. However, if it read some other number (higher numbers of the cardboard), the command was led to another "if then else" command. Here, if the LED sensor read greater than 500 (Pocahontas was on the cardboard), Pocahontas would bear to the left until the sensor read less than 500 (reached the white line), where it would then continue on forward. If the LED sensor read less than 500 (was on the white line) but kept moving to the left, then the command was for Pocahontas to bear to the right until it hit the white tape, where it would also continue on.
We also experimented with the motor power because Pocahontas was moving too fast or turning too fast before the LED sensor could read the reflection and the cyborg to process the numbers. So, we decreased the power of the motor (shown).
Dr. Robert Langer's Lecture
His lecture was fascinating because Dr. Langer's work showed how engineering (applications of sciences) could save or significantly improve lives. I was surprised by the number of his projects and the number of people (different doctors, researchers, scientists, and engineers) he worked with.
Some of his projects included nanoparticles that bind to desired cancer cells so that these cells could be identified and microchips injected under one's arm with wells containing different drugs that could be controlled using a cell phone or a computer.
I personally liked the Powerpoint slide showing the reasons NIH reviewers gave during many different years for rejecting the project grant applications. This showed how difficult this job is and how much time and effort it takes to produce drugs or medical devices that could help people.
Friday, March 1, 2013
Subscribe to:
Posts (Atom)