Increasing accuracy of eigen/eig function

26 ビュー (過去 30 日間)
Osama Anwar
Osama Anwar 2021 年 1 月 28 日
コメント済み: Osama Anwar 2021 年 1 月 28 日
How can I increase decimal places of the result obtained by using eig function
Here is my code I need it for phi
clear
clc
syms t
m=45000;
k=57*10^6;
h=3;
n=5;
M=zeros(n,n);
K=zeros(n,n);
Phi=zeros(n,n);
H=zeros(n,1);
w=zeros(n,1);
Q=zeros(n,1);
% applicable if all stories' m and k are same
for i=1:n
for j=1:n
if i==j
M(i,j)=m;
K(i,j)=2*k;
if and(i==n,j==n)
K(i,j)=k;
end
end
if or(i==j+1,j==i+1)
K(i,j)=-k;
end
end
H(i,1)=i*h;
end
M
K
[phi,d]=eig(K,M);
phi
phi matrix is
I want to have more accurate values
  2 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 1 月 28 日
The display-forma is not the full precision of the result. Try:
format long
before running the eigenvalue calculation.
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 1 月 28 日
@Jan: OK

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

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 1 月 28 日
The display-forma is not the full precision of the result. Try:
format long
before running the eigenvalue calculation.
  1 件のコメント
Osama Anwar
Osama Anwar 2021 年 1 月 28 日
Thanks it helped

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by