how to get function value at any input, after solving Differential eq. using dsolve

3 ビュー (過去 30 日間)
Solution to below diff . eq. using dsolve command is:
Z= dsolve('Dy=1+t.^2','y(1)=-4');
Z=(t*(t^2 + 3))/3 - 16/3
Now how to write code to get the value of Z at t = 2

採用された回答

Torsten
Torsten 2024 年 2 月 3 日
syms t y(t)
Z= dsolve(diff(y,t)==1+t^2,y(1)==-4)
Z = 
Z_at_2 = subs(Z,t,2)
Z_at_2 = 
Z_at_2_numeric = double(Z_at_2)
Z_at_2_numeric = -0.6667
fplot(Z,[-2 2])
grid on
  2 件のコメント
Muhammad Asad
Muhammad Asad 2024 年 2 月 3 日
Great, Many thanks
Dyuman Joshi
Dyuman Joshi 2024 年 2 月 3 日
Hello @Muhammad Asad , if this answer solved your problem, please consider accepting the answer.
Accepting the answer indicates that your problem has been solved (which can be helpful to other people in future).

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by