write three MATLAB functions involving the three forms of the equation of a line
ID: 2079532 • Letter: W
Question
write three MATLAB functions involving the three forms of the equation of a line.
Please add comments in the code
Write the following functions per the requirements listed A) Slope-intercept form of a linear equation y mx b where m slope and b yintercept Assume the function is called hw1 lin10. The function you write will have three input parameters, m,b and an x value and the function returns the y value associated with the x value. The function must include help comments that list what the inputs and outputs are as well as how to use the function B) Point-slope form of a linear equation (y yl) m(x x1) where m slope and x1, 1 is the first point Assume the function is called hw1 lin20. The function you write will have four input parameters, m x1, y1 and an x value and the function returns the y value associated with the x value. The function must include help comments that list what the inputs and outputs are as well as how to use the function. C) Standard form of a linear function Ax By C where A, B, Care constants Assume the function is called hw1 lin30. The function you write will have four input parameters, A, B, C, and an x value and the function returns the y value associated with the x_value. The function must include help comments that list what the inputs and outputs are as well as how to use the functionExplanation / Answer
A.
function [ y ] = hw1_lin1( m,b,x )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
m=input('Enter the value of slope');
b=input('Enter the value of intercept');
x=input('Enter the value of x-coordinate');
y=m*x+b;
disp(y)
end
b.
function [ y ] = hw1_lin2( m,x,x1,y1 )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
m=input('Enter the value of slope');
x1=input('Enter the value of x intercept');
y1=input('Enter the value of y intercept');
x=input('Enter the value of x-coordinate');
y=m*(x-x1)+y1;
disp(y)
end
c.
function [ y ] = hw1_lin3( a,b,c,x )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
a=input('Enter the value of A');
b=input('Enter the value of B');
c=input('Enter the value of C');
y=(c-a*x)./b;
disp(y)
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.