# Set assumption on function and Solve differential equation

조회 수: 2 (최근 30일)
Mark 2022년 5월 14일
댓글: Mark 2022년 6월 5일
I try to solve the phi_m (y) equation by substituting Eq.(7.100) into Eq.(7.99) and below is my code but it did not come out with the result as the screenshoot did.
If there is anything that I can do, please feel free to let me know!
Thank you very much!
clc
clear
a=0.6
m=1
syms x y phi_function_y_m phi_function_x_m
lamda_m=(2*m-1)*pi/a;
% deta_phi=diff(phi,x,2)+diff(phi,y,2)
phi_h=phi_function_y_m*cos(lamda_m*x)+phi_function_x_m*sin(lamda_m*y)
deta_deta_phi_h=diff(diff(phi_h,x,2)+diff(phi_h,y,2),x,2)+diff(diff(phi_h,x,2)+diff(phi_h,y,2),y,2)

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

### 채택된 답변

Parsa 2022년 5월 15일
편집: Parsa 2022년 5월 15일
Hi Mark
Note that the homogeneous solution , phi_h, consists of harmonic functions, sines and cosines. Therefore their nth-derivitives are also harmonic but with an amplified magnitude with respect to thier arguments.
So, by substituting eq.7.100 in eq.7.99, with symbolic parameters and variables , Matlab executes 2nd and 4th derivitives of sine and cosine, which their magnitudes are in the form lambda^2 and lambda^4 respectively. In result , according to eq.100 , all terms will have a common factor of lambda^4, and so Matlab will represent just 2 terms of sine and cosine with lambda^4 factor and does not represent the form you want.
In fact, if you do the substitution manually, you'll get what you want, but Matlab applies symbolic derivation and shows the final result.
In your code, I suggest make all parameters symbolic, include, m, a, lambda_m, and then run your code.
I tried this, as below.
clc
clear
syms a m lamda_m x y phi_function_y_m phi_function_x_m
% deta_phi=diff(phi,x,2)+diff(phi,y,2)
phi_h=phi_function_y_m*cos(lamda_m*x)+phi_function_x_m*sin(lamda_m*y);
deta_deta_phi_h=diff(diff(phi_h,x,2)+diff(phi_h,y,2),x,2)+diff(diff(phi_h,x,2)+diff(phi_h,y,2),y,2)
deta_deta_phi_h =
You can also find the solution for phi_m numerically, according to the 4th-order ordinary differential equation for phi_m.
You could just write 2 mfiles, one of them is a function wherein you define your parameters and differential equation in the form of state-space, and the other one for simulation and solving the equation with a solver such 'ode45'.
Here is the state-space for the equation. After solving by ode solver, you could take the first element of state matrix, which is phi_m.
##### 댓글 수: 3이전 댓글 1개 표시이전 댓글 1개 숨기기
Parsa 2022년 5월 30일
편집: Parsa 2022년 5월 30일
Hi Mark
Sorry for this short delay !
phi_m should be solved by the linear constatnt coefficient ordinary differential equation. So for solving such equations you could generate a function includes all variables, as well as differential equation(s). It will be achieved by defining a state matrix, such I've shown in the image. Then the differential equation system will be generated simply, because the first equation in the system is the derivative of the first state, which is equal to second state, and so on. The last equation is a superposition of all previous defined states, because this is a linear constant coeff. ode.
and the examples in the document.
Best
Parsa
Mark 2022년 6월 5일
Got it! Thank you very much Parsa!

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

### 카테고리

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

R2022a

### Community Treasure Hunt

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

Start Hunting!

Translated by