Need Help Starting Code

2 Ansichten (letzte 30 Tage)
Bailey Smith
Bailey Smith am 23 Jun. 2018
Kommentiert: Image Analyst am 24 Jun. 2018
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 Kommentare
dpb
dpb am 24 Jun. 2018
What's the units of the elevation data?
If you have distance and time, what's definition of velocity?
Image Analyst
Image Analyst am 24 Jun. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by