Surface plot form 1d data

15 ビュー (過去 30 日間)
mk_ballav
mk_ballav 2019 年 2 月 18 日
回答済み: Star Strider 2019 年 2 月 18 日
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)

回答 (1 件)

Star Strider
Star Strider 2019 年 2 月 18 日
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')

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by