Write a function mirror that will receive one input vector consisting of y coordinates of data points. The function will fit a second order polynomial through the points
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:14| Question number:19.14
All Answers
total answers (1)
mirror.m
function mirror(y)
x = 1:length(y);
p = polyfit(x,y,2);
longx = 1:0.1:length(x);
curve = polyval(p, longx);
ests = polyval(p,x);
oppests = ests + (ests - y);
plot(x,y,'g*',longx,curve,x,oppests,'r*')
end
Data on the flow of water in rivers and streams is of great interest to
civil engineers, who design bridges, and to environmental engineers,
who are concerned with the environmental impact of catastrophic
events such as flooding.
need an explanation for this answer? contact us directly to get an explanation for this answer