Diagonal cross section of function z(x,y) for x=y
1 回表示 (過去 30 日間)
古いコメントを表示
I have a function as z(x,y) and I want to plot z(x,y) vs x=y. How can I plot it? Cross section of function z(x,y) for x=y
I will be glad if you help
1 件のコメント
DGM
2022 年 3 月 12 日
How is the function defined? is it a MATAB function? Is this using symbolic tools? Or is it just a 2D numeric array?
採用された回答
その他の回答 (2 件)
Simon Chan
2022 年 3 月 12 日
Easier to assign some values where x=y in function meshgrid as follows:
If the assigned values for x and y are different, then the following does not work.
x = -10:0.1:10;
y = -10:0.1:10;
A = 1; % Assume A=1
[X, Y] = meshgrid(x, y);
D = 4; T = 0; K=1;
for p = 0:(D-1)
alpha = 2*pi*p/D;
T= T + exp(1i*K*(cos(alpha)*X+sin(alpha)*Y));
end
Z = A*abs(T/D).^2;
plot(X(X==Y),Z(X==Y))
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!