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');
A = 0.33; % albedo of Earth
S = 1367; % solar constant
Tg4 = (1+Pa/Pe)*Teff^4;
Tg = Tg4^(1/4); % ground temp
Ti4 = (Pl/(2*Pe*opl))*Teff^4;
Ti = Ti4^(1/4); % temp of top layer
the only way I don't get an error is if I use .^ for Tg and Ti. But I want the output for Ti and Tg to be scalars, not arrays. What am I doing wrong?
Jumi <plopony@hotmail.com> wrote in message <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');
> A = 0.33; % albedo of Earth
> S = 1367; % solar constant
> Tg4 = (1+Pa/Pe)*Teff^4;
> Tg = Tg4^(1/4); % ground temp
> Ti4 = (Pl/(2*Pe*opl))*Teff^4;
> Ti = Ti4^(1/4); % temp of top layer
>
>
> the only way I don't get an error is if I use .^ for Tg and Ti. But I want the output for Ti and Tg to be scalars, not arrays. What am I doing wrong?
>
> Thanks =)
You're using variables "opl" and "Pl" without having defined them. Assuming that they are both scalars, the code you've posted works fine. Are you positive that Pa and Pe are both scalar quantities?
"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.
"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
>
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.