Re: fminsearch



"Andrea Asoni" <andrea.asoni@xxxxxxxxx> wrote in message <gs8aqp$1u6$1@xxxxxxxxxxxxxxxxxx>...

maybe i got the code all wrong (it is my third day of self-thought matlab!) but z and b are scalars.
p(i,1) is defined as the (i,1)th element of vector x times z plus the (i,1)th element of vector y times b.

i want to maximize (with respect to z and b) the function L which is the sum of all the p's (who should be functions of z,b and the 'data' x,y)...
does it make any sense? did i get it all wrong?

Sorry, but I don't buy it. ;-)

MATLAB does not lie, so it must be you who
are mistaken here.

Read the error message.

??? Subscripted assignment dimension mismatch.

Error in ==> maxlik at 6
p(i,1)=z*x(i,1)+b*y(i,1);


It refers to the line above. Since i is a scalar,
defined by the for loop above it, we know that
p(i,1) is a scalar.

Likewise, x(i,1) and y(i,1) are scalars. If either
of them were empty, then you should have
gotten a different error message.

You can only have an assignment mismatch if
the result on the right hand side of this expression
is not a scalar. There are two ways for that to
happen. The right hand side must be either an
empty array, or it must be a vector or an array.

It will be empty if either of z or b is empty, or
if they are vectors or matrices.

You need to use the debugger to identify which
is happening. Also, as I said in my first response,
learn to do without the globals. This may well
be one of the reasons you have this error in the
first place. It is very easy to have a variable
stepped on without your realizing it.

John
.



Relevant Pages

  • Re: fminsearch
    ... Read the error message. ... Since i is a scalar, ... empty array, or it must be a vector or an array. ... learn to do without the globals. ...
    (comp.soft-sys.matlab)
  • Re: 3D Matrix Manipulation
    ... Any variable with more than 2 dimensions is an array, and certain operations that are only defined for matrices will not work on arrays. ... matrix multiplication will not work because one of the pieces of data being multiplied is not a matrix and elementwise multiplication will not work because the two pieces of data being multiplied are not the same size and neither is scalar. ... > Another problem is that I am able to process the first line in the command> window yet as soon as I run the script, I get an error message depending> on the syntax. ...
    (comp.soft-sys.matlab)
  • Re: mail about unknown user gets lost
    ... error message gets lost, is not conform to the standards: ... smtp-server.domain1 does not accept such message with empty ... reverse path in the envelope; ... recipient of this notification SHOULD be the address from the ...
    (comp.mail.misc)
  • Re: SETTING CONDITION CODE
    ... even though it might be empty. ... statement or to allowing the error message to appear on ... For IBM-MAIN subscribe / signoff / archive access instructions, ... send email to listserv@xxxxxxxxxxx with the message: GET IBM-MAIN INFO ...
    (bit.listserv.ibm-main)
  • Re: Can we stop emitting an error for managed-keys.bind?
    ... For fun I just tried started named with no options and an empty ... empty zones ... That shouldn't be an error message, since named isn't actually going to ... Yours for the right price. ...
    (comp.protocols.dns.bind)