フィルターのクリア

Constructing Matrix from for loop

2 ビュー (過去 30 日間)
Ghulam Murtaza
Ghulam Murtaza 2016 年 8 月 8 日
コメント済み: Walter Roberson 2016 年 8 月 9 日
hi i have code
x=[1:5;1:5];
y=x'
V1=x1+x2+1
for i=1:5;
M=subs(V1,[x1 x2],[y(i,1) y(i,2)])
end
i got values step by step how i can form a matrix by these values in this code .
please help

採用された回答

Walter Roberson
Walter Roberson 2016 年 8 月 8 日
M(i,:) = subs(V1,[x1 x2],[y(i,1) y(i,2)]);
  3 件のコメント
Ghulam Murtaza
Ghulam Murtaza 2016 年 8 月 9 日
編集済み: Ghulam Murtaza 2016 年 8 月 9 日
when i put data in points then there is answer in fraction not in points. please help me
Walter Roberson
Walter Roberson 2016 年 8 月 9 日
Before doing the symbolic calculation you need to convert all of your numbers into the symbolic numeric form that you want. You do that by using sym() with the optional flag that indicates the numeric format. For example if you currently have an array like
x = [7.35, 84.1248, -43.19e-7]
you might choose to use
x = [sym('7.35', 'd'), sym('84.1248', 'd'), sym('-43.19e-7', 'd')]
In combination with changing the Digits setting as needed, this allows you precise control over how your numbers will be represented for the purpose of your symbolic computations.
If this is not what you wanted then you should be questioning why you are using symbolic computations (which are designed to give exact answers when-ever possible) to deliberately compute inexact answers.
See also vpasolve() and vpa() and double()

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by