How to do get my code to display an answer using f print f. I want to display the result using fprint f

2 ビュー (過去 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)
Unrecognized function or variable 't'.

採用された回答

Star Strider
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)
The temperature at 180 seconds is 62.114 °C
See the documentation for fprintf for details.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by