フィルターのクリア

how do i get values of ratios instead of the 0 matlab gives me?

3 ビュー (過去 30 日間)
Raymond Kazibwe
Raymond Kazibwe 2016 年 12 月 16 日
コメント済み: Star Strider 2016 年 12 月 19 日
how do i get values of ratios instead of the 0 matlab gives me?

採用された回答

Star Strider
Star Strider 2016 年 12 月 16 日
We need to know what you are doing.
See if format long (or other format options) changes the result.
  2 件のコメント
Raymond Kazibwe
Raymond Kazibwe 2016 年 12 月 19 日
format long does not change anything!Here's the program below close all;clc; format short A=[1 -1 -1 1 ;2 0 2 0;0 -1 -2 0;3 -3 -2 4]; b=[0;8;-8;7]; n=length(b) x=zeros(n,1) x(n)=b(n)/A(n,n)
Star Strider
Star Strider 2016 年 12 月 19 日
With this code:
format short g
A=[1 -1 -1 1 ;2 0 2 0;0 -1 -2 0;3 -3 -2 4];
b=[0;8;-8;7];
n=length(b)
x=zeros(n,1)
x(n) = b(n)/A(n,n)
I get:
x =
0
0
0
1.75
as the final result.
If you want to do the division on your entire vector and matrix, this assignment:
x_mtx = bsxfun(@rdivide, b, A)
gives you this result:
x_mtx =
0 0 0 0
4 Inf 4 Inf
-Inf 8 4 -Inf
2.3333 -2.3333 -3.5 1.75

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by