フィルターのクリア

Nothing on my plot is showing up, anyone know why?

2 ビュー (過去 30 日間)
Luke Radcliff
Luke Radcliff 2016 年 5 月 31 日
コメント済み: Luke Radcliff 2016 年 6 月 1 日
figure(1);
clf;
x = [linspace(50,100,1000) linspace(0,50,1000)];
z = -x(1).*x(2).*exp(-(x(1)^2 + x(2)^2)./3);
plot(x,z,'c-');

回答 (2 件)

Chad Greene
Chad Greene 2016 年 5 月 31 日
Something's there, but it's a straight line of zeros because exp(-(x(1)^2 + x(2)^2)./3) equals zero and cyan is difficult to see.
  2 件のコメント
Luke Radcliff
Luke Radcliff 2016 年 6 月 1 日
編集済み: Luke Radcliff 2016 年 6 月 1 日
well not always say if i do like
x= [1 1] or x = [3 5]
I get values but they are negative. I guess I should just set the domain so i can see the negatives, how do i do that
Luke Radcliff
Luke Radcliff 2016 年 6 月 1 日
編集済み: Walter Roberson 2016 年 6 月 1 日
the equation also isn't giving me a vector of answers just 1.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2016 年 6 月 1 日
You define your x as the row concatenation of two linspace() . You extract two values from that linspace and you plot. And the portion you plot is numerically zeros.
[x1,x2] = ndgrid(linspace(-10,10,1000), linspace(-10,10,1000));
z = -x1.*x2.*exp(-(x1.^2 + x2.^2)./3);
surf(x1, x2, z, 'edgecolor', 'none');
  3 件のコメント
Walter Roberson
Walter Roberson 2016 年 6 月 1 日
You have two independent variables, x and y, and one depending variable, z. You need 3 dimensions to plot the shape it makes. You could, though, instead produce a 2D image that is color coded:
imagesc(z)
Luke Radcliff
Luke Radcliff 2016 年 6 月 1 日
3 variables, yea why did I think i could... been a long day, don't even have to graph it I read the question wrong. Thanks for your help though.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by