what particular need of this , why we need it to be in a 'sol' what is the benefit for this
2 views (last 30 days)
Show older comments
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')
0 Comments
Accepted Answer
David Young
on 18 Feb 2012
"sol" is the name of a variable. You could replace "sol" by any other name, and as long as you are consistent (you change every "sol" to the same thing) your code will work exactly the same. So there's nothing special about a "sol" - it's just a name.
In the code, the value of the variable "sol" is an array. This is a data structure with multiple elements, so you can hold many different numerical values in one place, and access individual elements by row and column, as in sol(1,101).
0 Comments
More Answers (0)
See Also
Categories
Find more on Testing Frameworks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!