フィルターのクリア

How to send to an output file !

2 ビュー (過去 30 日間)
Fatima Al Marzoqi
Fatima Al Marzoqi 2014 年 6 月 27 日
回答済み: Image Analyst 2014 年 6 月 27 日
I create a code, and decide to send an output to a file, but not all the values displayed.
This is the code
x=-1:0.1:1;
a=1+(x.^2)+((x.^4)/2);
b=exp(x.^2);
c=abs(b-a);
y=[x a b c];
fid=fopen('Taylor.exp','w');
disp('X Approx.Values exp(x.^2) Absolute Error')
disp('________________________________________________________________________________________________')
fprintf(fid,'%.1f\t\t%.7f\t\t%.7\t\t%.7f\n',y);
fclose(fid);
please I want the answer as soon as possible!

回答 (1 件)

Image Analyst
Image Analyst 2014 年 6 月 27 日
You have a .7 instead of a .7f. I also opened it in write text mode. Try this:
clc;
x=-1:0.1:1;
a=1+(x.^2)+((x.^4)/2);
b=exp(x.^2);
c=abs(b-a);
y=[x a b c];
fid=fopen('Taylor.exp','wt');
fprintf(fid,'X Approx.Values exp(x.^2) Absolute Error\n');
fprintf(fid, '________________________________________________________________________________________________\n');
fprintf(fid, '\n%.1f\t\t%.7f\t\t%.7f\t\t%.7f\n', y);
fclose(fid);
type 'Taylor.exp'

カテゴリ

Help Center および File ExchangePower and Energy Systems についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by