These must be completed in MATLAB Question 1. The velocity of a rocket is given
ID: 2074294 • Letter: T
Question
These must be completed in MATLAB
Question 1. The velocity of a rocket is given as:
where t is time in seconds and velocity is in meters per second.
Do the following and print the results to the Command Window:
1. Create a vector for time, incremented by 0.5 seconds.
2. Create a corresponding velocity vector.
3. Find the velocity of the rocket at t = 8 s.
4. Create a vector of the rocket's average acceleration
Question 2.
Given the following vector A and vector B
Do the following and print the results to the Command Window.
1. Determine whether matrix multiplication of A and B (AB) is possible. Use the function size and a relational operator to make the determination.
2. Find the resultant scalar, C, from matrix multiplication of A and B(C=AB).
3. Transpose B and concatenate vectors A and B into a single vector, D. Replace the 5th element in D with the value 16.
4. Find the dot product of the vectors A and B.
14* 104 v(t) = 2000ln( 7 =) — 9.8t (14* 104) - 2100tExplanation / Answer
Question 1:
Matlab code
clear all;
clc;
close all;
i=0;
for t=0:0.5:10
i=i+1;
T(i,1)=t; %Creating a vector for time, incremented by 0.5 seconds.
V(i,1)=2000*log((14*10^4)/(14*10^4-2100*t)); %Creating a corresponding velocity vector.
if t==8 %Finding the velocity of the rocket at t = 8 s.
fprintf('Velocity of the rocket at t = 8 s is %f ',V(i,1))
end
end
dt=0.5;
for j=1:20
avgacceleration(j,1)=(V(j+1,1)-V(j,1))/dt; % Creating a vector of the rocket's average acceleration
end
Result:
Velocity of the rocket at t = 8 s is 255.666743
Question 2:
clear all;
clc;
close all;
A=[24 6 10];
x=size(A);
B=[3; 4; 13];
y=size(B);
if x(2)==y(1)
fprintf('Matrix multiplication is possible ')
C=A*B;
fprintf('The resultant scalar C, from matrix multiplication of A and B is %f ',C);
end
fprintf(' Transpose of matrix B is ')
Bt=B'
fprintf('concatenate of vectors A and B is ')
D = horzcat(A,Bt)
D(5)=16;
fprintf('after replacing 5th element matrix D is ')
D
fprintf('Dot product of vectors A and B is %f ',dot(A,B))
Reuslt:
Matrix multiplication is possible
The resultant scalar C, from matrix multiplication of A and B is 226.000000
Transpose of matrix B is
Bt =
3 4 13
concatenate of vectors A and B is
D =
24 6 10 3 4 13
after replacing 5th element matrix D is
D =
24 6 10 3 16 13
Dot product of vectors A and B is 226.000000
>>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.