Answered 5 days AfterMay 25, 2021

Answer To: Dummy

Sayantan answered on May 30 2021
146 Votes
Answer 1:
%linear plot
x=[1 2 3 4 5 6]
y= [14 28 50 66 156 190]
plot(x,y, 'r')
% logarithmic plot
x=[1 2 3 4 5 6]
y= [14 28 50 66
156 190]
loglog(x,y, 'k')
plot:
Polynomial fitting curve
Code:
x=[1 2 3 4 5 6]
y= [14 28 50 66 156 190]
p= polyfit(x,y,2)
plot( x,y, 'r')
grid on
hold on
p = polyfit( x, y, 2)
s = sprintf('y = ((%.1f) x^2 + (%.1f) x + (%.1f))',p(1),p(2),p(3));
ynew= polyval ( p, x)
plot( x, ynew, 'b')
hold off
plot:
Power function fitting curve
Code:
x=[1 2 3 4 5 6]
y= [14 28 50 66 156 190]
plot( x,y, 'r')
grid on
hold on
p = polyfit(log(x),log(y),1);
m = p(1)
b = exp(p(2))

f=@(x) b*x.^m
ezplot(@(x) b*x.^m ,[x(1) x(end)])
plot:
Exponential fit:
Code:
x=[1 2 3 4 5 6]
y= [14 28 50 66 156 190]
plot( x,y, 'r')
grid on
hold on
f = fit(x',y','exp2')
plot(f,x,y)
hold off
plot:
As seen from the above three plots the polynomial plot fits the best because of less deviation from the original trend. At higher values of the x axis the exponential plot shows a considerable deviations. Whereas the polynomial plot sticks around the actual graph with minimum deviations. The power function is of the worst fitting because of huge deviations on either side of the original graph.
2. The datas for almeda country is taken from
https://covid-19.acgov.org/data.page
data for india is taken from many sources...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here