How to create a loop on a matrix whose elements are also a row/column matrix.

2 ビュー (過去 30 日間)
ASHA RANI
ASHA RANI 2020 年 6 月 30 日
コメント済み: ASHA RANI 2020 年 7 月 2 日
x= [ 0:pi/18:pi/2];
A=11;
B=12;
C=9;
D=8;
K1=12;
K2=18;
syms V
E = A.*sin(x)+B.*cos(x);
F = C.*sin(x)+D.*cos(x);
Z = [ E-V K1; K2 F-V];
DT=det(Z); %%%%%determint of Matrix Z which comes a polynomial of order 2 in V
cx = coeffs(DT,V);
S0 = collect(simplify(cx(:,3)),k) %%%%%coefficient of V.^2
S1 = collect(simplify(cx(:,2)),k) %%%%%coefficient of V
S2 = collect(simplify(cx(:,1)),k) %%%%constant term
v1 = zeros(1,length(x));
for ii = 1:numel(x)
V1 = roots([S0(ii),-S1(ii),S2(ii)]);
v1(ii) = sqrt((V1(1,1))./p);
end
Firstly,I want to calculate determint of matrix Z which comes a polynomial of degree 2 in V for all value of x. Then I want to find two values of V from that polynomial....Plz Help
  2 件のコメント
Sargondjani
Sargondjani 2020 年 6 月 30 日
Please be more specific which part of the code is not working as you expected.
ASHA RANI
ASHA RANI 2020 年 7 月 1 日
Some elements of matrix Z atre function of x and some are constant. I want to create a for loop on determint of matrix Z for all value of x.

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

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 7 月 1 日
編集済み: KALYAN ACHARJYA 2020 年 7 月 1 日
%Partial Code
DT=zeros(1,length(x));
for i=1:length(x)
Z=[E(i)-V K1; K2 F(i)-V];
DT(i)=det(Z);
end
  2 件のコメント
madhan ravi
madhan ravi 2020 年 7 月 1 日
Preallocation:(
ASHA RANI
ASHA RANI 2020 年 7 月 2 日
Elements of DT are polynomial of degree 2 in V for each x. We want to solve that polynomial to get two values of V . please help

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by