MATLAB Answers

## Surface plot form 1d data

Asked by mk_ballav

### mk_ballav (view profile)

on 18 Feb 2019
Latest activity Answered by Star Strider

### Star Strider (view profile)

on 18 Feb 2019
I want to make a mesh plot from 1D equation. I have an one-dimensional equation. I want to make a mesh plot with such equation. I am expecting the diagonal of the matrix resulting solution of equation.
%% 1D line plot
x = linspace(0,1000,1000);
C = x.*(1-2/3*x);
figure(1):plot(x,C)
%% create 2D mesh from x-cordinate;
[X,Y] = meshgrid(x,x);
%%% how to Convert C to 2D matrix
surf(X,Y,CC)

#### 0 Comments

Sign in to comment.

## 1 Answer

Answer by Star Strider

### Star Strider (view profile)

on 18 Feb 2019

We have absolutely no idea what result you are expecting.
Try this:
%% 1D line plot
x = linspace(0,1000,1000);
C = @(x) x.*(1-2/3*x);
figure(1)
plot(x,C(x))
%% create 2D mesh from x-cordinate;
[X,Y] = meshgrid(x);
%%% how to Convert C to 2D matrix
surf(X,Y,C(X+Y), 'EdgeColor','none')

#### 0 Comments

Sign in to comment.