"Michal Kolaj" <toomanybullets@hotmail.com> wrote in message <ibpvu7$iot$1@fred.mathworks.com>...
> Hello all, I am a selftaught programmer and I am having a problem with the following:
>
> So I need to solve for 2 variables, I have 2 equations. Easy enough... but:
>
> 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)
>
> my equations:
>
> RH=sqrt(4*z^2+1)2*z;
> RV=1/sqrt(4*z^2+1);
> VD=c*(1RV)
> HD=c*(1RH)
>
> I have vectors for both VD and HD (my known variables)
>
> How do i cycle through solutions for z,c for each pair of VD HD ?
>
> 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.
>
> Any help would be appreciated.
> 
        
I don't think you need to use a forloop. 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.
Roger Stafford
