필터 지우기
필터 지우기

How can I solve the following derative problem in Matlab ?

조회 수: 1 (최근 30일)
Vuqar Samedov
Vuqar Samedov 2020년 10월 4일
댓글: Bjorn Gustavsson 2020년 10월 6일
  댓글 수: 3
Vuqar Samedov
Vuqar Samedov 2020년 10월 4일
편집: Vuqar Samedov 2020년 10월 4일
Dear Steven Lord,
I can not write the command correctly in the matlab program. I need help.
syms x t
>> y=(x^3+5*x-4);
>> x=(t^2+t);
>> t=-1;
>> dy_dt = diff(y,t)
Error using sym/diff (line 70)
Second argument must be a variable or a nonnegative integer specifying the number of differentiations.
Vuqar Samedov
Vuqar Samedov 2020년 10월 5일
I am a student. I'm learning a new Matlab program. Friends, please help me solve this problem.

댓글을 달려면 로그인하십시오.

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2020년 10월 4일
When you assign:
t = -1;
t becomes a standard double scalar, and is no longer a symbolic variable. So that's where you go completely wrong. Before that, when you describe your variable/function y it becomes a function of x, after that you assign x to some polynomial in t. That second assignment does not have "time-traveling" powers, it does not retroactively affect the definition for y, think of an assignment as "from here on forward...". Try to change order of your definitions...
HTH
  댓글 수: 1
Vuqar Samedov
Vuqar Samedov 2020년 10월 5일
I am a student. I'm learning a new Matlab program. Friends, please help me solve this problem.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Vuqar Samedov
Vuqar Samedov 2020년 10월 6일
  댓글 수: 2
Vuqar Samedov
Vuqar Samedov 2020년 10월 6일
How can I solve the following derative problem in Matlab ?
Bjorn Gustavsson
Bjorn Gustavsson 2020년 10월 6일
You are pretty much on the right track.
1, Define your symbolic variables.
2, Look at the problem at hand, not that y depends on x that in turn, depends on t.
3, try do the assignments to y and x in different order, and see what happens when you run diff(y,x) and diff(y,t).
4, if something get you closer to the solution, have a look at how you can proceed from there.
5, a useful function might be matlabFunction - have a look at the help and documentation for that one.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by