Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We will do some MATLAB programming exercises about in-line function, online help

ID: 2081658 • Letter: W

Question

We will do some MATLAB programming exercises about in-line function, online help and plotting graphs 1. Creating and using Inline function F = inline ('function formula') Ex.>>Fx = inline('x^2+sin(x)); >>Fx(pi) Using inline function to calculate the area of circles with radius of 2, 5, 20, respectively. Using on-line help >>help a) help with a function name, ex, >>help lang b) look for, the keyword search >>look for determinant >>look for eigenvalue Calculate the determinant and eigenvalue of the following matrix A = [1 0 -1 2 2 0 3 1 2], c) help desk

Explanation / Answer

%Q.1 code

%matlab code to calculate area of circle with given radius
clc;
clear all;
close all;

f=inline('pi*r^2'); %area of circle=pi*radius^2

%for radius=2,area of circle is:
fprintf('area of circle ,when radius is 2')
f(2)

%for radius=2,area of circle is:
fprintf('area of circle ,when radius is 5')
f(5)

%for radius=2,area of circle is:
fprintf('area of circle ,when radius is 20')
f(20)

output:

area of circle ,when radius is 2
ans =

12.5664

area of circle ,when radius is 5
ans =

78.5398

area of circle ,when radius is 20
ans =

1.2566e+03

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote