Help using poly fit to determine equation constants of power function and plotting the linear form
Show older comments
- x axis (t) 172 241 392 483 608 812 959 1305
- y axis (h) .20 .60 2.0 4.0 8.0 20.0 40.0 80.0
Using the above data I am required to...
- Enter the data as vectors
- Plot the data and by changing the axes determine the function type
- Using polyfit, determine the equation constants
- Create a plot (using the linear form of the graph)that includes the highlighted data points along with your best fit equation
I entered the data as vectors...
t=[172,241,392,483,608,812,959,1305]
h=[0.200,0.6.00,2.00,4.00,20.00,40.00,80.00]
I determined the data represents a power function by plotting it on a log log series
I THINK I determined the constants using the following commands...
>> p=polyfit(log(t),log(h),1)
p =
2.9861 -17.0002
If I am correct the 2.9861 represents m and -17.0002 represents b in the equation y=m*x^b
I really don't know how to graph the linear form correctly and I am unsure of how to do it to include the "highlighted data points"
I attempted to do it using the commands...
>> m=p(1)
m =
2.9861
>> b=p(2)
b =
-17.0002
>> y=[m*t+b];
>> plot(y)
I am pretty sure the graph isn't correct and there aren't any highlighted points... Any input on what I did wrong and should do differently would be GREATLY appreciated. Thank you in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Fit Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!