Error on mathlab, and I have no idea how to correct it, me out

AI Thread Summary
The user encountered an error in MATLAB stating that inputs must be a scalar and a square matrix while executing a function for a class assignment. The issue arose from using "e" instead of the correct MATLAB function for the exponential, which is "exp()". After receiving suggestions, the user resolved the problem by replacing "e" with "exp()". This highlights the importance of using MATLAB's built-in functions correctly to avoid similar errors. Proper syntax is crucial for successful code execution in MATLAB.
vienhuynh
Messages
2
Reaction score
0
error on mathlab, and I have no idea how to correct it, please help me out :(

Hello guys, I was using a class assignment using matlab, and the code is provided by the professor. All we need to do is use plug the function in and run it. But for some reason, I got this error:
? Error using ==> mpower
Inputs must be a scalar and a square matrix.

Error in ==> @(x)(e^(cos(x))+8*x^2-3-x-4)^(1/5)


Error in ==> fpi at 5
x(i+1)=g(x(i));

I don't see a problem in that, can someone point it out for me?
 
Physics news on Phys.org


Thank you for your reply, I found the answer. Seems like in matlab, there is no "e", have to use exp() instead.
 

Similar threads

Replies
4
Views
1K
Replies
5
Views
2K
Replies
3
Views
2K
Replies
4
Views
3K
Replies
5
Views
3K
Back
Top