how to calculate a difference of function with any parameter

1 visualización (últimos 30 días)
function y=f(x)
for i=10
y=i*sin(x)
end
end
calculate the change in y/change in x vs i

Respuesta aceptada

Torsten
Torsten el 8 de En. de 2022
Editada: Torsten el 8 de En. de 2022
function main
h = 1e-6;
xleft = -pi;
xright = pi;
n = 200;
dx = (xright-xleft)/n;
x = xleft:dx:xright;
change_in_y_by_change_in_x = (f(x+h)-f(x))/h;
plot(x,change_in_y_by_change_in_x)
hold on
plot(x,cos(x)) % for comparison, plot (sin(x))' = cos(x)
end
function y = f(x)
y = sin(x)
end
  7 comentarios
Torsten
Torsten el 8 de En. de 2022
Please include the function f in which you calculate "N" dependent on "da" callable as
N = f(da)
shiv gaur
shiv gaur el 8 de En. de 2022
Dr torsten N is the root ie p function is dependent on da also the change in the value of p for different value of da for some value of na that is given this is running program so Dr torsten pl help the by varying the value of da the value of changing p ie N so we have to calculate the DP/Dda vs da plot
this is running script so minor mistake in program so pl help for three value of na 1.45 1.49 1.50
DP/Dda vs da thanks fig like att .file

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by