Electrical Engineering > Lab Experiment > University of Alberta MECE 390 Lab 2 (All)
MEC E 390 – Summer 2020 Lab #2 Due: May 26, 2020 Instructions: Submit your assignment as a single PDF file (for the Main Report) through eClass. In addition, upload all code files (and data f ... iles, if any) to eClass. Answer all questions in the Main Report. In an Appendix, include print outs of all codes used and refer to them in your Main Report. Plot figures should be included in the Main Report. Questions have weight as indicated. Up to 30 points may be deducted for incomplete or disorganized Main Report. Late assignments will not be accepted. 20/100 1. Write a Matlab function called plotfunc that does the following: (a) Receives the name of another Matlab function as an input (e.g. func01, which calculates ?(?)). (b) Plots the function, including a horizontal line at ?(?) = 0, so that the user can visually see the roots (see fplot()). (c) Performs the plot inside a while loop that begins with a default interval, −75 ≤ ? ≤ 75 and keeps asking the user for new interval limits until the user is satisfied and the loop ends. Hint: use input() to accept input from the user through the command window. Hint: create your function (M-file) with: function plotfunc(funcname) ... fplot(@(x) funcname(x),[a,b]) Then call it in your command window with: >> plotfunc(@(x) func01(x)) 20/100 2. Test your plotfunc with the function ?(?) = −3.1?3 + 28.5?2 − 3.2? − 100.4 Find an interval and produce a single plot that clearly shows the three roots. Hint: Note the dot-operators used to perform element-wise algebraic operations function y = func01(x) % Function for Lab 2 y = -3.1.*x.^3 + 28.5.*x.^2 - 3.2.*x-100.4 [Show More]
Last updated: 3 years ago
Preview 1 out of 2 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
May 27, 2021
Number of pages
2
Written in
All
This document has been written for:
Uploaded
May 27, 2021
Downloads
0
Views
94
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·