The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Simple Code wont run!
Replies: 4   Last Post: Nov 1, 2012 2:47 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 4
Registered: 11/1/12
Re: Simple Code wont run!
Posted: Nov 1, 2012 2:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Ok so now I have:

function [cosine] = james(x)
function [cosine]= euler(x)
cosine = exp.^((1i)*x)-1i*sin(x);


Matlab says that to compute


i need to have exp as exp.^ and not exp^ but this still causes an error of :

Error using ^
Inputs must be a scalar and a square
To compute elementwise POWER, use POWER
(.^) instead.

Error in euler (line 3)
cosine =e^(1i*x)-1i*sin(x);

What exactly am doing wrong? I put the exp.^ just as matlab said but Matlab still says there is the same error!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.