3D plot. Invalid expression. Why?

1 view (last 30 days)
I am trying to plot a simple function but I get error:
Z = -25.6+ ((1/(1+10^(7.6-X.)))*(-24.6+Y.));
Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched
delimiters.
Code:
x=(5:0.1:10);
y=(0:1:50);
[X,Y]=meshgrid (x,y);
Z = -25.6+ ((1/(1+10^(7.6-X.)))*(-24.6+Y.));
When I try other functions it works but not this one.

Accepted Answer

Walter Roberson
Walter Roberson on 4 May 2020
Edited: Walter Roberson on 4 May 2020
Z = -25.6+ ((1./(1+10.^(7.6-X))).*(-24.6+Y));
in particular no periods after X and Y
  2 Comments
Zaid Assaf
Zaid Assaf on 4 May 2020
Doesnt work either
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.279373e-132.
> In mpower>generalMpower (line 107)
Walter Roberson
Walter Roberson on 4 May 2020
there is no / or \ operator in the code I posted.
You might not have noticed that I also changed the / to ./ and ^ to .^

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!