Need help writing a code or an example of a four-point forward and three-point central finite difference method in Matlab
2 ビュー (過去 30 日間)
古いコメントを表示
I have attached a screenshot of the problem where I need to use the given finite difference methods to calculate the bending moment for the beam.
I was more concerned on how I would perform the finite difference methods that are shown in the screenshot: four-point forward finite difference for the first point(x=0). Three-point central finite difference for the intermediate points and the four-point backward finite difference formula for the last point(x=360). An example of even just one of those would help me get going again.
Here is what I have so far:
{%Start.
%Input variables. x= [0 24 48 72 96 120 144 168 192 216 240 264 288 312 336 360];
y= [0 -0.111 -0.216 -0.309 -0.386 -0.441 -0.473 -0.479 -0.458 -0.412 -0.345 -0.263 -0.174 -0.090 -0.026 0];
%Use the four-point forward finite difference for the first point (x=0).
%Use the three-point central finite difference for the intermediate points.
%Use the four-point backward finite difference formula for the last point (x=360).
t = 0:1:360; dy2dx2 = gradient(x,y,1)
%Input variables for Bending moment expression. I=720; %Moment of Inertia, I (in^4). E=29*10^6; %Elastic modulus, E (psi).
%Calculate bending moment with bending moment expression, M. M=E*I*dy2dx2;}
I'm really lost and stuck on how I would set up any of the methods in matlab. use gradient or a loop?
Thank you for your time and please let me know if I forgot to add anything.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!