フィルターのクリア

How would I go about plotting "eqn = diff(du) + u == 3* cos(w*t)"

1 回表示 (過去 30 日間)
Dinakar Chappa
Dinakar Chappa 2017 年 3 月 25 日
In my various attempts to try and plot this function, I keep getting errors.
ezplot( 'diff(du) + u /( 3* cos(0.5*t))' , [0 15] , u)
In my latest attempt, I received the error: "Error using sym/ezplot (line 45) The number of variables must not exceed two when plotting an equation." (Note that when I changed the 3rd value (u) to t, I received the same error.") The error seems self explanatory, but is there a way I can try to graph this even though it can't go beyond 2 variables. (Also note that du is declared as the derivative of u)

回答 (1 件)

Nagini Venkata Krishna Kumari Palem
Nagini Venkata Krishna Kumari Palem 2017 年 3 月 28 日
In my understanding you want to plot an expression with two variables. The function you are using 'ezplot' accepts only single variable. MATLAB has 'fmesh' function which allows you to pass two variables. And 'diff' function helps you to obtain derivatives of 'u'. You can use the following expression.
fmesh(@(u,t) (diff(u)/stepSize)+u/(3*cos(0.5*t)), [0 15])
For more information take a look into the following documentation page fmesh documentation

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by