필터 지우기
필터 지우기

how to plot a curve fitting on a semilog

조회 수: 3 (최근 30일)
mohamed
mohamed 2016년 4월 7일
댓글: mohamed 2016년 4월 8일
im trying to plot a curve fitting on a semi log graph to get its slope this is what ive tried
pws=[1150 1794 1823 1850 1876 1890 1910];
t=[0 2 4 8 16 24 48];
tp=3*24;
for i=2:length(pws)
horn(i)=((t(i)+tp)/(t(i)))
end
semilogx(horn,pws,'O-')
m=polyfit(horn,pws,1)
m(1)
k=((162.6*q*b*u)/(m(1)*h))
set(gca,'YLim',[1780 1960])
hold on
mm=polyval(m,horn)
semilogx(horn,mm,'-r');
but when i try it all i get is that
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 4월 7일
Your variable q is not defined in this code.
mohamed
mohamed 2016년 4월 7일
q=500;
pwf=1150;
tp=3*24;
h=22;
phi=0.2;
rw=0.3;
b=1.13;
ct=20e-6;
u=1;

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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 8일
You are using horn as your base variable to fit against, but horn is not monotonic. If you
plot(horn,pws)
you can see that clearly.
semilogx(horn,pws) does not show how bad the graph is because horn(1) is 0 (because you did not assign any value to horn(1)), and log(0) is -infinity, so the first data point is not drawn on the semilogx plot.
  댓글 수: 1
mohamed
mohamed 2016년 4월 8일
ok after i tried deleting the first element in the vector pws and horn and it helped a little but the generated best fit is still wrong here it is
the best fit curve is suppose to cut the y axis at 1950 and have a slope of 99

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

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by