Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Unexpected Error Message

Subject: Unexpected Error Message

From: Mason Savage

Date: 6 Dec, 2012 16:50:11

Message: 1 of 2

Does anyone know why I keep on getting an unexpected Matlab error in this program. It says it occurs in line for (%the original equation) and I think it has something to do with a coefficient to x? I don't know, I have ran this program before with a different equation and it works. ANy help would be greatly appreciated and suggestions on the fix...



x=input('Type the number 32 for your intial guess:')
x=((x-32)*5/9)+273.15

y=-5.6703*e-8x^4-2x+548.30 %orginal equation

while abs(y)>.0001
a=x+.0001 %find derv 1
ya=-5.6703*e-8a^4-2a+548.30


b=x-.0001 %find derv 2
yb=-5.6703*e-8b^4-2b+548.30

dydx=(ya-yb)/(a-b) %derv

z=dydx*a-ya

x=z/dydx
y=-5.6703*e-8x^4-2x+548.30
end

Subject: Unexpected Error Message

From: Justin Ashmall

Date: 6 Dec, 2012 17:04:08

Message: 2 of 2

"Mason Savage" <savinator@yahoo.com> wrote in message <k9qic3$r71$1@newscl01ah.mathworks.com>...
> Does anyone know why I keep on getting an unexpected Matlab error in this program.
>
> y=-5.6703*e-8x^4-2x+548.30 %orginal equation

You can't type "8x" or "2x". I guess you mean "2*x"? I'd try adding a few brackets too.

Also, it's much more useful if you post the exact error message...

Cheers,
Justin

Tags for this Thread

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.

Contact us