フィルターのクリア

hi how can i evaluate the function below from x=1,x=2 into a step of 0.1 y=x/(x2+1)

2 ビュー (過去 30 日間)
Esther
Esther 2024 年 4 月 8 日
回答済み: Sam Chak 2024 年 4 月 8 日
  1. Y=X/(X2+1)
  1 件のコメント
Manikanta Aditya
Manikanta Aditya 2024 年 4 月 8 日
編集済み: Manikanta Aditya 2024 年 4 月 8 日
You can do this:
x = 1:0.1:2; % Define the range of x with a step of 0.1
y = x./(x.^2 + 1); % Evaluate the function
disp(x)
1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.0000
disp(y)
0.5000 0.4977 0.4918 0.4833 0.4730 0.4615 0.4494 0.4370 0.4245 0.4121 0.4000

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

回答 (2 件)

KSSV
KSSV 2024 年 4 月 8 日
x = 1:0.1:2; % Define the range of x with a step of 0.1
y = x./(x.^2 + 1); % Evaluate the function
plot(x,y)

Sam Chak
Sam Chak 2024 年 4 月 8 日
syms x
y = eval('x/(x^2 + 1)') % <-- check if the function is correct
y = 
xa = 1; % start point of [xa ≤ x ≤ xb]
xb = 2; % final point of [xa ≤ x ≤ xb]
xs = 0.1; % step size
xval= xa:xs:xb % values of x from xa to xb
xval = 1x11
1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
y = subs(y, x, xval) % substitute the values of 'xval' into 'x'
y = 
plot(xval, y, '-o'), grid on, xlabel x, ylabel y

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by