How to write N*1 Matrix with M-1 element

8 ビュー (過去 30 日間)
Cagin Keskin
Cagin Keskin 2019 年 4 月 16 日
コメント済み: Cagin Keskin 2019 年 4 月 16 日
How to write N*1 Matrix with M-1 element and find the Ax = b lineer system of equation
t(1)=0;
k=.01
N=1/k
h=1.5;
z=k/h;
m=k/h^2;
M=60/h
S(1)=70;
sigma=.1;
r=0.12;
K=100;
for i=2:M
S(i+1)=S(i)+h;
end
for j=2:N
t(j+1)=t(j)+k;
end
for i=1:M
alpha(i)=sigma^2*m*S(i)^2
beta(i)=r*(z/2)*S(i)
end
% v(i)=[(1-alpha(i))]
% y(i)=[(beta(i)+(alpha(i)/2))]
% z(i)=[((alpha(i)/2)-beta(i))]
for i=1:M
A=full(gallery('tridiag',M,(1-alpha(i)),(beta(i)+(alpha(i)/2)),((alpha(i)/2)-beta(i))))
end
  2 件のコメント
Rik
Rik 2019 年 4 月 16 日
Your question is still unclear to me. The part ending with a question mark doesn't seem to have a lot to do with the rest of your question.
Can you explain a bit further what you mean?
Cagin Keskin
Cagin Keskin 2019 年 4 月 16 日
I am trying to apply finite difference method with lineer system equation Ax = b but ı dont know how to write x and b code on matlab
WhatsApp Image 2019-04-16 at 11.52.10(1).jpeg

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by