Question: USING MATLAB 1. Write a program that adds the numbers from 1 to 15 that can be exactly divisible by 3 (hint: you might need



1. Write a program that adds the numbers from 1 to 15 that can be exactly divisible by 3 (hint: you might need to use while loop and remainder function) The sum is 45 2. Write a program that creates a random 10 x 10 matrix, takes the values on row 3 and multiplies them with each corresponding value in column 6 (convert column 6 into a row by using transpose in MATLAB). Then takes the average of these values. Run your program and verify that it operates correctly. 3. Write a program that creates a 10 x 10 matrix of zeros and replaces the diagonal of said matrix with the values from 0 to a user's input number, evenly spaced (increasing at a constant rate). Run your program and verify that it operates correctly (hint: you might need to use nesting for loops) Sample run Input Stop number = 10 Output = 2.2222 0 0 0 0 3.3333 0 0 0 0 1.1111 0 0 0 0 0 0 4.4444 0 5.5556 0 0 0 0 6.6667 7.7778 0 0 0 10.000 8.8889 0 As you can see, the diagonal starts from 0, and increases constantly/evenly spaced in increments of 1.1111), and ends at the user's input number 10. 4. Write a program that asks the user for their last three Midterm grades and Final Exam grade. The three Midterms have the same grade weight (23.3%) and together are worth 70% of the total class grade. Final is worth 30% of the total class grade. The program will calculate and display their Final grade with a letter grade corresponding to it. Run your program and verify that it operates correctly (hint: you might need to use "If, else statements") A B D 90-100% 80-89.9% 70-79.9% 60-69.9% 0-59.9% F Sample run Input Midterm grades = [ 90, 86, 70 ] Input Final grades = [92] Output Final class grade is: 85% B 5. Write a program that uses Euler's method to solve the following initial value problem using a step of h = 0.2 second. Knowing that the analytical solution is y(t) =t+1 -0.5e', make the program calculate and display the true error at t = 1 second. dy y(0) = 0.5 y-t, dt 6. Write a program that uses Euler's Method to solve the same initial value problem in Question 1, this time with a step of h = 0.1 second from 0 to 1 second. Knowing that the analytical solution is y(t) =t+1 -0.5e', make the program graph both analytical and numerical results. (hint: use MATLAB's plot function)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
