need help in this

1 回表示 (過去 30 日間)
Nasir Qazi
Nasir Qazi 2012 年 2 月 18 日
編集済み: Cedric 2013 年 10 月 15 日
can somebody tell me the purpose of this 'sol' sol(1,1)=P; sol(2,1)=X(5);
can you give examples

採用された回答

Wayne King
Wayne King 2012 年 2 月 18 日
Apparently sol is an MxN matrix. The code is simply assigning the 1st row, 1st column the value of P. And the second row, first column the value of X(5) -- the fifth element of X.
Without more details, that's all the help I can give.
P = 5;
% create a random vector X so we can select the fifth element
X = randn(100,1);
% create a 2x2 matrix of zeros
sol = zeros(2,2);
% set 1st row, 1st column equal to P
sol(1,1) = P;
%set 2nd row, 1st column equal to the fifth element of X
sol(2,1) = X(5);
  3 件のコメント
Nasir Qazi
Nasir Qazi 2012 年 2 月 18 日
global z P
clear sol
z=[0.2 0.8];
P=5*14.69;
options = optimset('Display','off');
[X]=fsolve(@PT3,[0.01 0.9 0.01 0.9 500],options);
x0=X;
sol(1,1)=P;
sol(2,1)=X(5);
for i=1:63
P=(5+i)*14.69;
[X]=fsolve(@PT3,x0,options);
x0=X;
sol(1,i+1)=P;
sol(2,i+1)=X(5);
end
sol(1,64)=968;
sol(2,64)=513+459.67;
plot(((sol(2,:)-459.67)-32)./1.8+273.15,sol(1,:)./14.69,'b')
hold on
clear sol
z=[0.2 0.8];
P=5*14.69;
options = optimset('Display','off');
[X]=fsolve(@PT4,[0.01 0.9 0.2 0.8 700],options);
x0=X;
sol(1,1)=P;
sol(2,1)=X(5);
for i=1:59
P=(5+i)*14.69;
[X]=fsolve(@PT4,x0,options);
x0=X;
sol(1,i+1)=P;
sol(2,i+1)=X(5);
end
sol(1,61)=968;
sol(2,61)=513+459.67;
plot(((sol(2,:)-459.67)-32)./1.8+273.15,sol(1,:)./14.69,'r')
clear sol
z=[0.7 0.3];
P=5*14.69;
options = optimset('Display','off');
[X]=fsolve(@PT3,[0.7 0.3 0.999 0.001 350],options);
x0=X;
sol(1,1)=P;
sol(2,1)=X(5);
for i=1:99
P=(5+i)*14.69;
[X]=fsolve(@PT3,x0,options);
x0=X;
sol(1,i+1)=P;
sol(2,i+1)=X(5);
end
sol(1,101)=1550;
sol(2,101)=770;
plot(((sol(2,:)-459.67)-32)./1.8+273.15,sol(1,:)./14.69,'m')
clear sol
z=[0.7 0.3];
P=5*14.69;
options = optimset('Display','off');
[X]=fsolve(@PT4,[0.01 0.9 0.3 0.7 600],options);
x0=X;
sol(1,1)=P;
sol(2,1)=X(5);
for i=1:99
P=(5+i)*14.69;
[X]=fsolve(@PT4,x0,options);
x0=X;
sol(1,i+1)=P;
sol(2,i+1)=X(5);
end
sol(1,101)=1550;
sol(2,101)=770;
plot(((sol(2,:)-459.67)-32)./1.8+273.15,sol(1,:)./14.69,'g')
Nasir Qazi
Nasir Qazi 2012 年 2 月 18 日
why do actually need it , thats wht i am asking ... just give a little explanation

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by