Path: news.mathworks.com!not-for-mail
From: "Bobby Cheng" <bcheng@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: error with mpower
Date: Wed, 28 Oct 2009 15:52:08 -0400
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <hca7d8$e89$1@fred.mathworks.com>
References: <148229629.126692.1256747632594.JavaMail.root@gallium.mathforum.org> <hc9tfo$hpm$1@fred.mathworks.com>
Reply-To: "Bobby Cheng" <bcheng@mathworks.com>
NNTP-Posting-Host: chengb.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1256759528 14601 172.31.44.230 (28 Oct 2009 19:52:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 28 Oct 2009 19:52:08 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:580742


Unlike *, ^ does not do scalar expansion.

So .^ is the way to go for elementwise power.

---Bob.

"Steven Lord" <slord@mathworks.com> wrote in message 
news:hc9tfo$hpm$1@fred.mathworks.com...
>
> "Jumi" <plopony@hotmail.com> wrote in message 
> news:148229629.126692.1256747632594.JavaMail.root@gallium.mathforum.org...
>>I don't understand why I am getting an error when I run this. It says that 
>>there is an error with mpower... that the matrix must be a square. but 
>>here... I am just trying to raise a scalar to a scalar power...
>>
>> note... both Pa and Pe are scalars
>>
>> Pa = absorbed/ntrials;
>> Pe = emitted/ntrials;
>>
>> Teff = input('enter effective temperature in K');
>
> What do you/the user enter here?  Is Teff a scalar or a nonscalar?  My 
> guess is that it's nonscalar.  To check this, put a breakpoint on this 
> line in your code and step through the rest of the execution, making sure 
> on each line that the variables with which you're working have the sizes 
> you expect.
>
> -- 
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: 
> http://matlabwiki.mathworks.com/MATLAB_FAQ
>