How to do get my code to display an answer using f print f. I want to display the result using fprint f
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
This is my Code
close all
t_sec=[0 30 60 150 240];
Temp_C=[800 457 269 79 46];
time=0:1:250;
pa=polyfit(t_sec,Temp_C,4);
Pa=polyval(pa,time);
pb=spline(t_sec,Temp_C,time);
pc=pchip(t_sec,Temp_C,time);
plot(t_sec,Temp_C,'b*',time,Pa,'r-',time,pb,'g-',time,pc,'m-')
xlabel('Time(sec)')
ylabel('Temp(C)')
legend('Data','Polynomial interpolation','not-a-knot','shape-preserving')
t_3min=180;
T_3min=pchip(t,T,t_3min)
댓글 수: 2
채택된 답변
  Star Strider
      
      
 2022년 6월 21일
        Perhaps this — 
t_sec=[0 30 60 150 240];
Temp_C=[800 457 269 79 46];
time=0:1:250;
pa=polyfit(t_sec,Temp_C,4);
Pa=polyval(pa,time);
pb=spline(t_sec,Temp_C,time);
pc=pchip(t_sec,Temp_C,time);
plot(t_sec,Temp_C,'b*',time,Pa,'r-',time,pb,'g-',time,pc,'m-')
xlabel('Time(sec)')
ylabel('Temp(C)')
legend('Data','Polynomial interpolation','not-a-knot','shape-preserving')
t_3min=180;
T_3min=pchip(t_sec,Temp_C,t_3min);                              % Guessing That This Is What Is Actually Wanted
fprintf('\nThe temperature at %3d seconds is %.3f °C\n',t_3min,T_3min)
.
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




