y =
hi how can i evaluate the function below from x=1,x=2 into a step of 0.1 y=x/(x2+1)
Ältere Kommentare anzeigen
- Y=X/(X2+1)
1 Kommentar
Manikanta Aditya
am 8 Apr. 2024
Bearbeitet: Manikanta Aditya
am 8 Apr. 2024
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)
disp(y)
Antworten (2)
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)
syms x
y = eval('x/(x^2 + 1)') % <-- check if the function is correct
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
y = subs(y, x, xval) % substitute the values of 'xval' into 'x'
plot(xval, y, '-o'), grid on, xlabel x, ylabel y
Kategorien
Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


