Question

MATLAB: If I have a vector for time and distance, how do I create a velocity...

MATLAB:

If I have a vector for time and distance, how do I create a velocity vector?

For example,

T = [ 1; 2; 3; 4; ........]

D = [ 2; 2; 3; 4; ........]

and I need to find the velocity vector V = [] where the first value would be ((first value of D) / (first value of T))

Is there a way to create a loop for that and if so, what would be the code?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
V = [];
% For loop to calculate each value of V
for i=1:length(T)
    V(i) = D(i)/T(i);
end
% Calculating transpose of V
% So that V is also a column vector.
V = V'

Add a comment
Know the answer?
Add Answer to:
MATLAB: If I have a vector for time and distance, how do I create a velocity...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3) Develop a Matlab function to compute the velocity v of a particular projectile as a...

    3) Develop a Matlab function to compute the velocity v of a particular projectile as a function of time t. In this problem, the velocity profile is described by a piecewise function, and is parameterized by 11 parameters, a, b, c, d, g, h, k, m, n, p, and q, as at - bt, 05158 c-dt, 851516 v(t;a,b,c,d,g,h,k,m,n, p,q) = gt +h(t – k)?, 1651526 me=n(t-p), > 26 else. Your Matlab function must take as input the current time value...

  • how would i do this im matlab? im confused on the last two questions 3. [7...

    how would i do this im matlab? im confused on the last two questions 3. [7 points each) Find the distance traveled by a freely falling object on planets with different gravities. Consider the following two planets with different gravities, and use the time from 0 sec to 10 sec with a time increment of 1 sec from 0 to 10 sec. Planet Distance traveled: Gravity (m/s) 9.8 3.7 Earth Mars (1) Define a vector time that stores time values...

  • how would i do this code in MATLAB Step 2: Coding You are given a vector...

    how would i do this code in MATLAB Step 2: Coding You are given a vector t. We define x = di cos(it) 16 Yi = 1:1.sin(i-1) for i = 1,2,...,15,16 where multiplication of vectors is assumed to be point-wise. Create a 4x4 subplot. - In the ith location, plot the values of x; versus y; with a solid line (pick a color). - Make the axis tight Run the code a few times before submitting. Note that the size...

  • I just need some matlab help and assistance Refresher 1. Create a vector called A containing...

    I just need some matlab help and assistance Refresher 1. Create a vector called A containing 1, 2, 3,4, and 5 2. Create a vector called B containing 6,7, 8, 9, and 10 . Combine A and B to create an array called C where A is the first row and B is the second row 4. Find the 7th element in C 5. Determine the location of 8' in array C

  • i need matlab code for this question please solve in matlab platform 4. The upward velocity of the rocket is measured with respect to time and the data is given in the following table Velocity...

    i need matlab code for this question please solve in matlab platform 4. The upward velocity of the rocket is measured with respect to time and the data is given in the following table Velocity vs time data for a rocket Time,(s) Velocity,v (m/s 106.8 5 279.2 12 We wanted to approximate the velocity profile by Construct the set of linear equation and solve the equation for the coefficients a,b,and c in d) 4. The upward velocity of the rocket...

  • Matlab Question 2. For this problem you have to create a program that defines two vectors...

    Matlab Question 2. For this problem you have to create a program that defines two vectors of numbers: A and B and uses a for-loop to combine the values of A and B. Note that different parts of the question below specify different orders for combining the elements. To start this exercise start a MATLAB script called q2.m and put, at the top, the vector definition: B [11:20] Question 2a: Problem definition Copy the file q2.m to q2a.m. For this...

  • In matlab I have created the following function that calculates the distance a projectile travels when...

    In matlab I have created the following function that calculates the distance a projectile travels when shot from a cannon given initial velocity and theta. function [distance, xplot, yplot] = Cannon_lab8(V, theta) g = -9.81; % gravity m/s^2 k = 0.35; % drag coefficient Vx = V*cos(theta); %velovity in x-direction Vy = V*sin(theta); %velovity in y-direction dt = 0.01; % seconds, time step x = 0; y = 0; xplot(1) = 0; yplot(1) = 0; i = 2; while y...

  • Assume that y is a column vector with ten elements, write matlab code that will create...

    Assume that y is a column vector with ten elements, write matlab code that will create a stem plot of the vector starting at a horizontal axis value of 1. Add code that will create the stem plot of the vector starting at a horizontal axis value of 0. Create additional code that creates a stem plot but plots y at every other horizontal value (i.e., 0, 2, 4, etc)

  • I need to create a c++ print function that takes a vector of values ex: <1...

    I need to create a c++ print function that takes a vector of values ex: <1 2 3 4 5 6> and prints it in the correct way with the given dimensions. Example 2x3 = [[1,2,3],[4,5,6]] or 3x2 = [[1,2],[3,4],[5,6]]. To make this even more difficult there can be 3 dimensional matrixs. For example for <1 2 3 4 5 6 7 8 9 10 11 12> with dimensions depthXheightXwidth: 2x3x2 = [[[1,2],[3,4],[5,6]],[[7,8],[9,10],[11,12]]]. The depth height and width could be...

  • The problem below is a MATLAB question, please do it only Matlab, if you are not...

    The problem below is a MATLAB question, please do it only Matlab, if you are not familiar with Matlab or not equipped with the program itself on your computer kindly leave it to someone who is. Please show me the Matlab codes for these two parts of the problem, I need to put them in same (m.file) so please consider that. Either you type the code or "preferably" you take a snip of your screen and post to teach me...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT