Question: EENG 3308 Programming Languages for Design Mini Project 2 Points: 100 Assignment 1: Animating a Plot (50 Points) Problem: The MATLAB code with the initial


EENG 3308 Programming Languages for Design Mini Project 2 Points: 100 Assignment 1: Animating a Plot (50 Points) Problem: The MATLAB code with the initial conditions and one dimensional motion equation are given in the MProject2_Assignment1_base.m file. Modify the code to explore how to animate the plot, use functions to create plot function. Equation of motion in one dimension: x(t)=x0+vx *t + (ax * 2)/2 where a = acceleration y(t) = y0 + vyt+(ay* t2)/2 Initial condition Vx-10; Vy=20 aY = -9.8 t=0:5 (0 to 5 seconds) Note: You can also increment to 50 points using 0:0.1:5 for i=1: length(t) x(i)=vx *t(i) y(i)= vy* (i) + (ay * t(i) 2)/2 end Tasks: 1. Animate your plot by moving the plot function inside the for loop. Your final output should look like the attached graph. 2. Use a function to set the linewidth, marker and its color to get the final plot as below: 3. Set x limit 0 to 45 and y limit -10 to 25 and give title to the given plot. To Upload: Two .m files: Modified MATLAB base code along with the customized plot function. Assignment 2: Function to calculate difference in temperature in different days of the week (50 Points) Problem : Create a function to calculate difference in temperature i.e. difference in 2 vectors Temperature I and Temperature 2. Calculate which of the days of first week was hotter than days in second week. Tasks: 1. Create 2 input vectors of size 1*7 that will be used to store different temperature values for 2 weeks. 2. Make the function return the difference in temperature values and the hotter days. Hint: function ( diff, hotter] = differenceInTemperatures( Weekl, Week2) 3. Assign hotter = 0 if week 2 is hotter, hotter=1 if week 1 is hotter, and hotter = 2 if both the days have equal temperature To Upload: Two .m files: MATLAB code where you have given the inputs for the function along with the differenceInTemperatures function. Extra Credit: Use the GUI Commands for Assignment 2 to take the user input values for the temperature values. (25 Points) clc, clear, close all % X(t) = x0 + vx * t + (ax * t^2) / 2 % y(t) = y + vy * t + (ay * t^2) / 2 %% Setup % Initial Conditions vX = 10; VY = 20; ay = -9.8; t = linspace() %from 0 to 50 x = zeros(size(t)); y = zeros(size(t)); %% Calculate the X and Y points in Space for i = 1:length(t) x(i) = vX * t(i); y(i) = vy * t(i) + (aY*t(i)^2) /2; plot() hold on pause () end %%Visualize the results grid on; grid minor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
