Questions: 150

Answers by our Experts: 150

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

A ball is thrown vertically upwards with an initial velocity of 30 m/s.

Using a time step of 0.02 s up to 6.20 s, write a matlab code to give a plot of the vertical distance versus 

time for this ball.

Hint ; Motion under gravity is described by the equation : 𝑣𝑦 = 𝑣𝑜𝑦𝑡 +1/2𝑔𝑡²


and gravitational acceleration 𝑔 is here taken as negative.



Write a short comment explaining the code:


function DrawCircle(a, b, r)

%DRAWCIRCLE draws a circle on the coordinate plane

% a and b are the x-axis and y-axis coordinates of the center

% of the circle and r is its radius


t = 0:pi/180:2*pi;

x = r*cos(t) + a;

y = r*sin(t) + b;


plot(x, y, '-', a, b, '.');

axis equal

axis padded


text(a, b,'\leftarrow center')

title("The circle of radius " + string(r));

xlabel("X");

ylabel("Y")


end


Write a short comment explaining the code:



equipment = ["Power generator", "Transformer", "Stepper motor", "DC motor"];

price = [30, 10, 15, 8.5];

n = 4;

tot_number = 0;

tot_cost = 0;

for i=1:n

number = input("Enter number of " + equipment(i) + ": ");

tot_number = tot_number + number;

tot_cost = tot_cost + number * price(i);

end

avg_cost = tot_cost /tot_number;

fprintf("\n");

fprintf("The total number of equipment: %d\n", tot_number);

fprintf("The total cost: £%.2f\n", tot_cost);

fprintf("The average cost £%.2f per item\n", avg_cost);


Table 1: Driving styles associated with acceleration values


Driving style Economic (1) Normal(2) Aggressive(3)

Acceleration magnitude [m/s2 ]


Economic (1)

0.7-2.3


Normal(2)

2.31-3.30


Aggressive(3)

3.31-8.5 


Create variable ds mapping to store corresponding classification values of 1,2 or 3, which represent different driving style as shown in Table 1. You need to evaluate only the magnitude the of the acceleration/deceleration


Plot on the same figure the calculated acceleration and the classification variable ds mapping

against time. Use left side y-axis and a line style to plot the acceleration. Use right side

y-axis to illustrate the driving style classification. Hint: You may use plotyy to complete this

task. Add labels to all axes. Add legend to the figure.


Table 2: Example of classification


acceleration value ds_mapping

-1.2 1

1.23 1

3.2 2

-4.3 3

9.5 0






Knowing that average acceleration in a time interval ∆t = ti+1 − ti can be expressed as 𝑎𝑖 = 𝑣𝑖+1 − 𝑣𝑖 / ∆𝑡


where vi+1 − vi is the change in velocity between successive measurements,


write a code to: 

3) Calculate acceleration in m/s2 using speed and time data extracted from the dataset. Hint: You may use for ... end loop to complete this task.


Driving style Economic (1) Normal (2) Aggressive (3)


Acceleration magnitude [m/s2] 0.7-2.3 2.31-3.30 3.31-8.5


1.     A company is offering a job with a salary of Rs. 50,000.00 for the first year and a 4% raise each year after that. If that 4% raise continues every year,

Find the total amount of money an employee would earn in a 10-years career.(Using the geometric Progression).

Table 1: Driving styles associated with acceleration values


Driving style Economic (1) Normal (2) Aggressive (3)

Acceleration magnitude [m/s2 ] 0.7-2.3 2.31-3.30 3.31-8.5 



Create variable ds mapping to store corresponding classification values of 1,2 or 3, which represent different driving style as shown in Table 1. You need to evaluate only the magnitude the of the acceleration/deceleration.


2. Write a Matlab function that accepts a vector of values and returns a vector of derivatives at those points. You can assume that the values are given on an equally spaced array with spacing h. Use the two point central difference formula df dx = fi+1 − fi−1 2h for all points except the two endpoints. For the endpoints use a one-sided derivative that uses two points. The function should have the form


1.     Logs are stacked in a pile with 24 logs on the bottom row and 10 on the top row. There are 15 rows in all with each row having one more log than the one above it. (Use Sn=n/2[2a+(n-1) d])


a)      How many logs are in the stack?




LATEST TUTORIALS
APPROVED BY CLIENTS