How can i display a funtion dependenet to x ?

2 vues (au cours des 30 derniers jours)
Mallouli Marwa
Mallouli Marwa le 21 Jan 2017
Commenté : Star Strider le 23 Jan 2017
Hi How can i can i display f with values in function of x ?
L=3;
sol(1)=2;
psi=1;
f (x) = @(x) cos ( (sol(1)/L) *x)- cosh( (sol(1)/L) *x)+ psi *( sin( (sol(1)/L) *x)- sinh( (sol(1)/L) *x));

Réponse acceptée

Star Strider
Star Strider le 21 Jan 2017
This works:
L=3;
sol(1)=2;
psi=1;
f = @(x) cos ( (sol(1)/L) *x)- cosh( (sol(1)/L) *x)+ psi *( sin( (sol(1)/L) *x)- sinh( (sol(1)/L) *x));
x = linspace(-10, 10);
figure(1)
plot(x, f(x))
grid
xlabel('x')
ylabel('f(x)')
See the documentation for the linspace function to understand how to change the limits and number of elements in the ‘x’ vector.
  5 commentaires
Torsten
Torsten le 23 Jan 2017
Then I only see the "pencil and paper" solution.
Best wishes
Torsten.
Star Strider
Star Strider le 23 Jan 2017
Thank you, Torsten. I’m UTC-7 here. I appreciate your comments.
A numeric evaluation of df(x)/dx would be the gradient function.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Visualization and Data Export dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by