How did I get this crazy Plot?

clc
clear all
close all
A = 1.9;
R = 10;
a = 1;
X = linspace(0.0001,0.1,100);
% Y = a.*(1 + (A^(-R))*(X.^(R-1)));
for i = 1:length(X)
Y(i) = a*(1 + (A^(-R))*(X(i)^(R-1)));
end
plot(X, Y)
If you run the above code you will get a weird plot like this (shown below).
  1. How come those many ones in the Y-axis?
  2. Instead of a straight line, How come the plot it is a curve?
  • Could anybody please explain??*

댓글 수: 3

Dennis
Dennis 2018년 5월 11일
편집: Dennis 2018년 5월 11일
Y is not really 1 at every point. It is a question of precision, try vpa(Y).
For i=1 Y is 1 + 1.63e-39
Learner
Learner 2018년 5월 11일
Yes, Solved. Thanks a lot...
Guillaume
Guillaume 2018년 5월 11일
This is the plot I get (R2018a).
I see nothing unusual about it and I don't understand why you expect a straight line when you're effectively plotting y = c1*x.^9 + c2.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

제품

릴리스

R2015a

질문:

2018년 5월 11일

편집:

2018년 5월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by