Solve differential Equation for certain values of variable x

I have to find 4 values of z corresponding to x. After calculating differential equation how can I substitute x in the z(differential) equation? I have attached simplified code so that reader can understand.
x=[2 3 4 5];
syms x
z=diff(sin(x)-cos(x))

 Réponse acceptée

Birdman
Birdman le 15 Avr 2018
Modifié(e) : Birdman le 15 Avr 2018
Try this:
syms x
z(x)=diff(sin(x)-cos(x))
xVal=[2 3 4 5];
zVal=z(xVal)
What you need to do is to define a symbolic function z(x) and basically pass numeric values to that function as above. Really simple.

1 commentaire

Thanks alot. it works. Sometimes I would make simple things complex.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by