Why is this "z=x.*exp(-X.^2-Y.^2) " required?

7 ビュー (過去 30 日間)
S Priya
S Priya 2021 年 8 月 21 日
回答済み: Walter Roberson 2021 年 8 月 21 日
why is z=.... required??? and also why is (-X.^2-Y.^2)??


Walter Roberson
Walter Roberson 2021 年 8 月 21 日
The z= part is not required. The (-X.^2-Y.^2) part is not required either. However, as long as you have exp() you need to provide some argument to it.
For example, the following would be valid MATLAB code:
However, it does not do anything useful.
I suspect that you are looking for something closer to
[x, y] = meshgrid(-2:.2:2);
z = x .* exp(-x.^2 - y.^2);
surf(x, y, z, 'edgecolor', 'none')
xlabel('x'); ylabel('y');

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by