Problem with drawing a function in MATLAB

  • #1

Main Question or Discussion Point

hi guys ,

I'm trying to draw the following function , however MATLAB doesn't like my code . What am I doing wrong ?

z = x + (y – 100)^2

where x = -50 : 50,
y = 0 : 200


my code :

[x,y]=meshgrid(-50:1:50,-0:1:200)
surf(x , y , x. + (y.-100)^2)


thank you
 

Answers and Replies

  • #2
166
0
You have the dots in the wrong place
Code:
surf(x , y , x + (y-100).^2)
 

Related Threads on Problem with drawing a function in MATLAB

Replies
1
Views
23K
  • Last Post
Replies
2
Views
3K
Replies
13
Views
14K
Replies
1
Views
2K
  • Last Post
Replies
2
Views
2K
Replies
1
Views
6K
Replies
3
Views
9K
Replies
1
Views
725
Replies
2
Views
1K
Top