Info
This question is closed. Reopen it to edit or answer.
What did I do wrong with my code to get this "^" error?
1 view (last 30 days)
Show older comments
I input an equation as y=((x^2)*sin(x))/exp(x) and defined x as x=logspace(0,6,7); in the script. When I run it, i get a message saying "error using ^. Inputs must be a scalar and a square matrix."
I'm trying to evaluate the different y value outputs with a range of x inputs as 1,10,100,1000,10000,100000,1000000 using a dot product feature
0 Comments
Answers (1)
the cyclist
on 12 Jun 2016
Edited: the cyclist
on 12 Jun 2016
Try
y=((x.^2).*sin(x))./exp(x)
Notice that I added some periods, to denote element-wise operations.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!