how to perform a polyfit on semilog plot?
    조회 수: 11 (최근 30일)
  
       이전 댓글 표시
    
hi all. i have these two set of data, 'FOE' and 'Nc'. i want to plot FOE vs Nc in semilog plot (Nc placed on x axis increasingly and log scale, FOE on y axis, increasingly). how can i use polyfit command to pass a first order line from this semi-logarithmic graph and obtain slope and interceptof the fitted line. thanks in advance for all the advice you provide.
댓글 수: 0
채택된 답변
  Star Strider
      
      
 2018년 11월 12일
        Try this:
FOE=[0.000743 0.000747 0.000747 0.000746 0.000746 0.000744 0.000744 0.000743 0.00065 0.00065...
    0.000648 0.000648 0.000646 0.000646 0.000644 0.000644 0.000252 0.000252 0.000251 0.000251 0.000251...
    0.000251 0.00025 0.00025 0.000219 0.000219 0.000219 0.000219 0.000218 0.000218 0.000217 0.000217];
Nc=[3.76e-7 8.97e-8 5.09e-8 3.55e-8 2.73e-8 2.22e-8 1.87e-8 1.61e-8 1.42e-8 1.26e-8 1.14e-8 1.04e-8 9.6e-9...
    8.8e-9 8.2e-9 7.7e-9 7.2e-9 6.8e-9 6.4e-9 6.1e-9 5.8e-9 5.5e-9 5.3e-9 5.1e-9 4.8e-9 4.7e-9 4.5e-9 4.3e-9...
    4.2e-9 4e-9 3.9e-9 3.8e-9];
B = polyfit(log(Nc), FOE, 1);
fitFOE = polyval(B,log(Nc));
Slope = B(1);
Intercept = B(2);
figure
semilogx(Nc, FOE, '*',    Nc, fitFOE,'-')
grid
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

