Matrix is singular to working precision. Meshgrid

1 回表示 (過去 30 日間)
Kristian Stausland
Kristian Stausland 2021 年 3 月 18 日
コメント済み: Kristian Stausland 2021 年 3 月 18 日
[x,y] = meshgrid(0.1:0.01:1,0.1:0.01:1);
z = ((1-x)*(cos(2*pi*y+(pi + atan((cos(2*pi*y)-1)/(2*pi*(1-y)+sin(2*pi*y)))))-...
cos(pi + atan((cos(2*pi*y)-1)/(2*pi*(1-y)+sin(2*pi*y))))))/((1-y)*(cos(2*pi*x...
+(pi + atan((cos(2*pi*x)-1)/(2*pi*(1-x)+sin(2*pi*x)))))-cos(pi + atan((cos(2*pi*x)-1)/(2*pi*(1-x)+sin(2*pi*x))))));

採用された回答

Rik
Rik 2021 年 3 月 18 日
編集済み: Rik 2021 年 3 月 18 日
You aren't using elementwise operations anywhere. You should replace every * by .* and every / by ./, that way you will not be doing matrix operations.
[x,y] = meshgrid(0.1:0.01:1,0.1:0.01:1);
z = ((1-x).*(cos(2*pi*y+(pi + atan((cos(2*pi*y)-1)./(2*pi*(1-y)+sin(2*pi*y)))))-...
cos(pi + atan((cos(2*pi*y)-1)./(2*pi*(1-y)+sin(2*pi*y))))))./((1-y).*(cos(2*pi*x...
+(pi + atan((cos(2*pi*x)-1)./(2*pi*(1-x)+sin(2*pi*x)))))-cos(pi + atan((cos(2*pi*x)-1)./(2*pi*(1-x)+sin(2*pi*x))))));
surf(x,y,z),view(45,30)

その他の回答 (0 件)

カテゴリ

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