Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!news2.glorb.com!tr22g12.aset.psu.edu!news.mathforum.org!not-for-mail
From: Torsten Hennig <Torsten.Hennig@umsicht.fhg.de>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Solving matrix coefficients iteratively
Date: Fri, 07 Jan 2011 07:40:17 EST
Organization: The Math Forum
Lines: 67
Message-ID: <1377320967.18621.1294404049106.JavaMail.root@gallium.mathforum.org>
References: <178587791.18425.1294400753572.JavaMail.root@gallium.mathforum.org>
NNTP-Posting-Host: gallium.mathforum.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: support1.mathforum.org 1294404049 11102 144.118.94.39 (7 Jan 2011 12:40:49 GMT)
X-Complaints-To: news@news.mathforum.org
NNTP-Posting-Date: Fri, 7 Jan 2011 12:40:49 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:701203

> > Torsten Hennig <Torsten.Hennig@umsicht.fhg.de>
> wrote
> > in message
> >
> <2064831700.18092.1294393972987.JavaMail.root@gallium.
> 
> > mathforum.org>...
> > > The problem you are trying to solve is not clear
> > > from your description above.
> > > Please try again.
> > > 
> > > Best wishes
> > > Torsten.
> > 
> > My apologies. Basically I have a matrix [A] of
> size
> > 1x168 and I want to take each coefficient in that
> > matrx and use it in the formula Y*(N).^b + Z*(N).^c
> -
> > A = 0, where Y, b, Z and  c are all known.
> > 
> > I want matlab to return matrix [N] with each
> > coefficient of N being a number relating to the
> > corresponding coefficient of A by the equation
> above.
> > 
> > I am currently using function fzero() on the
> maximum
> > value of of matrix A and this (I believe) returns
> a
> > minimum value for N. However I want to check this
> by
> > doing a function like this to the entire matrix A
> so
> > I can see the corresponding N values.
> > 
> > Does that make more sense?
> > 
> > Thanks,
> > 
> > Chris
> 
> x0 = 1.0;
> For j = 1:n
> as = a(1,j);
> n(1,j) = fzero(@(x)f(x,as,Y,Z),x0);
> end
> 
> function y = f(x,as,Y,Z)
> y = Y*x^b + Z*x^c - as ;
> 
> Best wishes
> Torsten.

Sorry, of course, b and c also have to be supplied in f:

x0 = 1.0;
For j = 1:n
as = A(1,j);
N(1,j) = fzero(@(x)f(x,as,Y,Z,b,c),x0);
end

function y = f(x,as,Y,Z,b,c)
y = Y*x^b + Z*x^c - as ;

Best wishes
Torsten.