How to use matrix methods

I have an equation: [(V(t+Δt)-V(t-Δt))/2Δt]-[(V(x+Δx)+V(x-Δx)-2V(x))/(Δx)^2]=0
I need to Implement the numerical scheme in MATLAB using matrix methods in order to calculate 𝑉 when t=1, x=1, and Δt=0.1 and Δx=0.1 [whatever mesh size is appropriate]- how would I code this?

回答 (1 件)

Jan
Jan 2021 年 4 月 28 日

0 投票

t = 1;
x = 1;
dt = 0.1;
dx = 0.1;
Value = (V(t+dt) - V(t-dt)) / (2*dt) - (V(x+dx) + V(x-dx) - 2*V(x)) / (dx^2);
This is the trivial conversion. What exactly is your problem now?

1 件のコメント

Tai W
Tai W 2021 年 4 月 28 日
It comes up with V is undefined? Not sure how you can use matlab to calculate V

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

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2021 年 4 月 28 日

コメント済み:

2021 年 4 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by