<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/296426</link>
    <title>MATLAB Central Newsreader - How to solve for system of equation with set of known variables?</title>
    <description>Feed for thread: How to solve for system of equation with set of known variables?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.nl/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 15 Nov 2010 00:47:03 +0000</pubDate>
      <title>How to solve for system of equation with set of known variables?</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/296426#796112</link>
      <author>Michal Kolaj</author>
      <description>Hello all, I am a self-taught programmer and I am having a problem with the following:&lt;br&gt;
&lt;br&gt;
So I need to solve for 2 variables, I have 2 equations. Easy enough... but:&lt;br&gt;
&lt;br&gt;
In each of the 2 equations i have another 2 variables which I know and have a large list of. I need some sort of code to solve the system of equations for the two unknown variables for the entire list of known variables (like a loop statement)&lt;br&gt;
&lt;br&gt;
my equations:&lt;br&gt;
&lt;br&gt;
RH=sqrt(4*z^2+1)-2*z;&lt;br&gt;
RV=1/sqrt(4*z^2+1);&lt;br&gt;
VD=c*(1-RV)&lt;br&gt;
HD=c*(1-RH) &lt;br&gt;
&lt;br&gt;
I have vectors for both VD and HD (my known variables)&lt;br&gt;
&lt;br&gt;
How do i cycle through solutions for z,c for each pair of VD HD ?&lt;br&gt;
&lt;br&gt;
I can solve for any specific VD,HD pair using the solve function or fsolve but I do not know how to include a loop statement in this in order to solve for the full list of VD and HD vectors.&lt;br&gt;
&lt;br&gt;
Any help would be appreciated.&lt;br&gt;
---</description>
    </item>
    <item>
      <pubDate>Mon, 15 Nov 2010 01:06:03 +0000</pubDate>
      <title>Re: How to solve for system of equation with set of known variables?</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/296426#796115</link>
      <author>Michal Kolaj</author>
      <description>Solved:&lt;br&gt;
&lt;br&gt;
function F = conductivity(H,V)&lt;br&gt;
syms c z &lt;br&gt;
f1=((1/(4*(z^2)+1)^(1/2)))-((V-c)/(-c));&lt;br&gt;
f2=(((4*(z^2)+1)^(1/2))-(2*z))-((H-c)/(-c));&lt;br&gt;
F=solve(f1,f2);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
then:&lt;br&gt;
&lt;br&gt;
for n=1:71&lt;br&gt;
p(n)=conductivity(H(n),V(n))&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Sorry if I wasted anyones time.</description>
    </item>
    <item>
      <pubDate>Mon, 15 Nov 2010 01:38:03 +0000</pubDate>
      <title>Re: How to solve for system of equation with set of known variables?</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/296426#796121</link>
      <author>Roger Stafford</author>
      <description>"Michal Kolaj" &amp;lt;toomanybullets@hotmail.com&amp;gt; wrote in message &amp;lt;ibpvu7$iot$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello all, I am a self-taught programmer and I am having a problem with the following:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So I need to solve for 2 variables, I have 2 equations. Easy enough... but:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In each of the 2 equations i have another 2 variables which I know and have a large list of. I need some sort of code to solve the system of equations for the two unknown variables for the entire list of known variables (like a loop statement)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; my equations:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; RH=sqrt(4*z^2+1)-2*z;&lt;br&gt;
&amp;gt; RV=1/sqrt(4*z^2+1);&lt;br&gt;
&amp;gt; VD=c*(1-RV)&lt;br&gt;
&amp;gt; HD=c*(1-RH) &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have vectors for both VD and HD (my known variables)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How do i cycle through solutions for z,c for each pair of VD HD ?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can solve for any specific VD,HD pair using the solve function or fsolve but I do not know how to include a loop statement in this in order to solve for the full list of VD and HD vectors.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any help would be appreciated.&lt;br&gt;
&amp;gt; ---&lt;br&gt;
- - - - - - - - -&lt;br&gt;
&amp;nbsp;&amp;nbsp;I don't think you need to use a for-loop.  If you take the ratio VD/HD, this leads after some manipulation to a quadratic equation in z (after discarding the z = 0 root) which has two roots that have explicit solution expressions in terms of the above ratio.  You could evaluate this as a vectorized solution for a list of VD and HD vectors.  The value c can easily be obtained from this.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
  </channel>
</rss>
