What are the following brackets typically used for in MATLAB? If I create a new variable by typing “a = 5”, MATLAB will create a variable called “a” of type:
INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS
- What are the following brackets typically used for in MATLAB?
- ( )
- [ ]
- { }
- < >
- If I create a new variable by typing “a = 5”, MATLAB will create a variable called “a” of type:
- Integer
- Double
- Character
- Unsigned integer
- A matrix D is of size 5x9. How do I access the element in the 3rd row and 5th column?
- True or False? If false, provide the correct answer: I can create a break point anywhere I want in my MATLAB script.
- True or False? If false, provide the correct answer: I cannot pass arrays to functions as input or output arguments.
- Are the variables in a function accessible to you, i.e. are they visible in the workspace? Explain.
- Does an “if” statement need an else portion? Explain.
- Does a function always need to return a variable back to where it is called from? Explain.
- What is the difference between a regular array and a cell array? Explain with an example.
- What do I need to do if I want to plot 5 plots on the same figure as shown? Write the command for each plot. (Don’t worry about the contents of the plot or the axes)
- What is the difference between a “for” loop and a “while” loop? Explain with an example.
- Is there a way to see the value of a variable while the program is being executed (without printing it in the command window or to a file)? Explain.
- Is the following set of code correct for calling a function from the main script? If not, correct it. (Note: There can be more than one error)
- Where would you write your MATLAB script – in the command window or the editor? Why?
- Can a function call other functions? Explain with an example.
- Explain if the following functions are correct. If not, explain why
- When reading data from a text file, how will you specify the different data types to be read in? If a file has the decimal numbers in the first 3 columns and text in the next two columns, what would the command be?
- How do we specify the linewidth and fontsize when plotting data as a simple line plot?
- Say I plot the same data using two different styles (for example, plotting with straight lines and using dashed lines), how many data entries will appear if I ask MATLAB to insert a legend in the plot? Can I make the legend show only one entry? If so, how?
- Explain the steps and the MATLAB commands that I would have to follow to (i) read in data from a
MATLAB .mat file, (ii) plot the data in MATLAB and (iii) save the data to an excel file
- Coding question:
Gait analysis is the study of human motion with the aim of assessing and treating people with conditions that affect their ability to walk normally. One way to measure human motion is to attach markers to a person’s joints, (eg. Hip, knee and ankle) and optically track them using cameras while the person walks (as shown in the image).
Using the data obtained from tracking these markers, important information regarding the person’s gait, or walking motion, can be derived.
The attached file “joint_flexion.mat” contains data for markers at the hip, knee and ankle for a patient with a neurological disorder while walking. The file has the following variables:
- times: The timings of the flexion values in seconds
- angles: A matrix in which the first column represents flexion (i.e. angle) of the left hip, the second column is the flexion of the left knee and the third column is the flexion of the left ankle.
- foot_off: An array containing the timings (in seconds) of ‘foot off’ events, i.e. when the toe leaves the ground
- foot_strike: An array containing the timings (in seconds) of ‘foot strike’ events, i.e. when the heel hits the ground
- Part I: Write a script that has a function to read in the MATLAB file and save the information into separate variables. You can name the variables as you see fit. (10 points)
- Part II: Write a function to calculate the following (15 points)
- Range of angles (i.e. maximum – minimum) for the hip, knee and ankle
- Maximum value of the angles and the time at which the maximum occurs
- Part III: Write a function to create a plot of joint flexion versus time for all three joints on the same figure. Add lines indicating the timings of the ‘foot off’ and ‘foot strike’ events, and a legend. Use a linewidth of 3 and a fontsize of 14 for the figure. The plot should look similar to the one shown here (you can use any color of your choice): (15 points)
Attachments:
Related Questions
. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 1
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of
. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 2
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of