Need Help Starting Code
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
So I'm having some trouble planning out how to tackle this problem:
A toy rocket is powered by pressurized water that is discharged from the nozzle at the beginning of the flight.
a. Plot the elevation as a function of time
b. Compute and plot the velocity and acceleration of the rocket as functions of time
c. Write a MATLAB code that will automatically determine the thruster time, the maximum altitude, the maximum velocity, and the maximum acceleration
d. The tip of the rocket transports a 2.7 gram ping-pong ball. Determine the maximum support force for the ball.
I am given data: time (in seconds) and elevation (in meters). My first problem lies in the fact that I have a TON of data. 61 pages worth of data. 2 columns and 3280 rows of data. I know I'll need to preallocate this somehow to make it run efficiently. What help/tips do you have to help me get started and to help me make it run most efficiently?
EDIT: I have m=zeros(3280,2) as my preallocation. I am considering putting the data into a file and trying to pull it, to save space.
UPDATE 1:
rTimeData=fopen('rocket_time_data.txt','r');
formatSpec = '%f';
A = fscanf(rTimeData,formatSpec);
fclose(rTimeData);
rElevData=fopen('rocket_elev_data.txt','r');
formatSpec = '%f';
B=fscanf(rElevData,formatSpec);
fclose(rElevData);
%PART B
vel=sqrt(0^2+2*(9.81)*(B-0));
acc=vel/B;
My acceleration seems to not be right. Should it be a 3280x3280? (Part A plots fine, by the way.)
5 comentarios
dpb
el 24 de Jun. de 2018
What's the units of the elevation data?
If you have distance and time, what's definition of velocity?
Image Analyst
el 24 de Jun. de 2018
2 columns and 3280 rows of data is a microscopic amount of data, NOT "a TON of data". For example, it's like only one two-thousandths (0.05%) the amount of data in an ordinary digital image. It will easily all fit into your computer memory simultaneously.
For what it's worth, I'm attaching my demo of a projectile/trajectory. It computes just about anything one would ever want to know about a projectile.
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!