フィルターのクリア

How can I get data from evaluating a function, say y=x^2+5 and put it in table?

1 回表示 (過去 30 日間)
How can I get data from evaluating a function, say y=x^2+5 for x=0.1 to 0.9 for 50 points in between and put it in table?

採用された回答

the cyclist
the cyclist 2021 年 9 月 23 日
x = linspace(0.1,0.9,50);
y = x.^2+5;
tbl = table(y.');
  3 件のコメント
Shreen El-Sapa
Shreen El-Sapa 2021 年 9 月 23 日
If I want to appears it into command window.
the cyclist
the cyclist 2021 年 9 月 23 日
The semicolon at the end of a line of MATLAB code suppresses the output. So just leave the semicolon off of any line you want displayed to the command window.
x = linspace(0.1,0.9,50)
x = 1×50
0.1000 0.1163 0.1327 0.1490 0.1653 0.1816 0.1980 0.2143 0.2306 0.2469 0.2633 0.2796 0.2959 0.3122 0.3286 0.3449 0.3612 0.3776 0.3939 0.4102 0.4265 0.4429 0.4592 0.4755 0.4918 0.5082 0.5245 0.5408 0.5571 0.5735
y = x.^2+5
y = 1×50
5.0100 5.0135 5.0176 5.0222 5.0273 5.0330 5.0392 5.0459 5.0532 5.0610 5.0693 5.0782 5.0876 5.0975 5.1080 5.1190 5.1305 5.1425 5.1551 5.1683 5.1819 5.1961 5.2108 5.2261 5.2419 5.2582 5.2751 5.2925 5.3104 5.3289
tbl = table(y.')
tbl = 50×1 table
Var1 ______ 5.01 5.0135 5.0176 5.0222 5.0273 5.033 5.0392 5.0459 5.0532 5.061 5.0693 5.0782 5.0876 5.0975 5.108 5.119
These are very basic MATLAB questions. You might want to watch the MATLAB Onramp tutorial.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by