solve a system of equations.

1 Ansicht (letzte 30 Tage)
jin wang
jin wang am 12 Okt. 2015
Beantwortet: John BG am 31 Jan. 2016
Could any one please help me write the code to solve this system of equations?
Fcl=1/(1+0.155*Iclo*h);
hr=4*5.67*0.00000001*0.72*facl*((0.5*(Tcl+To)+273)^3);
To=(hr*Tr+hc*Ta)/h;
Tcl=To+Fcl(Tsk(i)-To);
h=hc+hr;
Unknown: Fcl hr To Tcl h.
Others are known.
I'm a beginner, I follow the format but error always shoot out. Want quick respond thank you.
  1 Kommentar
jin wang
jin wang am 12 Okt. 2015
Bearbeitet: jin wang am 12 Okt. 2015
What I wrote is like these.
syms Fcl hr To Tcl h
eqn1 = Fcl==1/(1+0.155*Iclo*h);
eqn2 = hr==4*5.67*0.00000001*0.72*facl*((0.5*(Tcl+To)+273)^3);
eqn3 = To==(hr*Tr+hc*Ta)/h;
eqn4 = Tcl==To+Fcl(Tsk(i)-To);
eqn5 = h==hc+hr;
[Fcl,hr,To,Tcl,h] = solve([eqn1,eqn2,eqn3,eqn4,eqn4,eqn5],[Fcl,hr,To,Tcl,hl])

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Okt. 2015
Is Fcl a function or a value? If it is a value then you need explicit multiplication with respect to (Tsk(i)-To)
Note that by default "i" refers to sqrt(-1) so your Tsk(i) may be trying to index Tsk(sqrt(-1)) unless you have assigned something else to i
The statements you show by themselves are not enough: you need to define numeric values for the other variables or you need to declare them as syms . If you take the syms route then I recommend changing Tsk(i) to just plain Tsk since the indexing does not matter to the solution of the equations.
The solution involves the roots of a polynomial of degree 7 whose leading term is equivalent to
158193*Iclo*facl*(31*Iclo*Ta*hc-31*Iclo*Tr*hc-200*Tr+200*Tsk(i))^3 * x^7
Because it is a 7 degree polynomial, the answer you get is going to be in terms of RootOf() and there is unlikely to be a closed form solution in the standard operations. You are going to need to solve for numeric roots by using vpasolve() or using double()
  15 Kommentare
jin wang
jin wang am 12 Okt. 2015
Exactly, so I should use this 7 sloution matrix to substitute into the following calculation? I keep receiving dimension not match error.
jin wang
jin wang am 12 Okt. 2015
Let's say I want to use RC and E which is 7x1 sym in the following code like this. How can I achieve this outcome?
Tsk(1+k,1)=Tsk(k,1)+deltat*(F(5)*(H(5)+(K(4)*(Tvsk(k,1)-Tsk(k,1)))-(RC+E)));

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

John BG
John BG am 12 Okt. 2015
Could you please define ranges for each unknown? Be conservative, please define the following: Fcl_min= Fcl_max= hr_min= hr_max= To_min= To_max= Tcl_min= Tcl_max= h_min= h_max=
  1 Kommentar
jin wang
jin wang am 12 Okt. 2015
you mean give them specific value or just write what you have writen in the code. I don't know why to do this.

Melden Sie sich an, um zu kommentieren.


John BG
John BG am 31 Jan. 2016
Mr Robertson considers as variables parameters that Mr Wang does not want to include as variables. I asked Mr Wang to define ranges because if the symbolic analysis does not help, then having a look at the equations may be useful, let me explain:
Since Mr Wang does not say anything else about the parameters, let me list them
eq1: Iclo assumed constant
eq2: facl and Tc assumed constant
eq3: Tr, Ta and hc assumed constant
eq4: Tsk(i) assumed constant
eq5: as in eq3, hc assumed constant
So, we have 5 variables to solve: Fcl hr To Tcl h
that I rename to: x y z w v
The simplified version of the 5 initial equations is:
eq1: x=1/(1+v)
eq2: y=((1+z)*.5+2)^3
eq3: z=(y+1)/v
eq4: w=z+x*(1-z)
eq5: v=1+y
I have define 5 ranges, that some of them may or may not help solve the system, but at least it's a start point:
x_min=-10;x_max=10;x_step=.1;x_range=[x_min:x_step:x_max]
y_min=-10;y_max=10; y_step=.1; y_range=[y_min:y_step:y_max]
z_min=-10;z_max=10; z_step=.1; z_range=[z_min:z_step:z_max]
w_min=-10;w_max=10; w_step=.1; w_range=[w_min:w_step:w_max]
v_min=-10;v_max=10; v_step=.1; v_range=[v_min:v_step:v_max]
now
v=v_range
x=1./(1+v)
figure(1);plot(v,x);grid on;hold all
z=z_range
y=((1+z)*.5+2).^3
figure(2);plot(z,y);grid on;w=z+x*(1-z)
simplifying some equations is possible:
eq3 and eq5 yield z=(y+1)/(1+y) nearly constant
eq4 with z nearly constant means w shape is w=1+x
I said 'nearly constant' because the simplified equations do not include the the parameters
Including parameters: Iclo facl Tc Tr Ta Tsk(i) hc
renamed: k1 k2 k3 k4 k5 k6 k7
eq1: x=1/(1+k1*v)
eq2: y=k2*((k3+z)*.5+2)^3
eq3: z=(k4*y+k5*k7)/v
eq4: w=z+x*(k6-z)
eq5: v=k7+y
give values to parameters, and find out if the 5 equations have a solution, or if perhaps the only way to solve this equations system is for values of parameters and variables within certain range windows.
Let me know if you progress with anything above explained
John

Community Treasure Hunt

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

Start Hunting!

Translated by