フィルターのクリア

surface plot for multiple vector points

3 ビュー (過去 30 日間)
Ashbub
Ashbub 2018 年 1 月 22 日
コメント済み: Ashbub 2018 年 1 月 22 日
Hi from the following code, I am getting the 3D scatter plot for multiple vector points(attached are the same plot from different view angle). F1111, F1122 etc. are coefficients calculated from the vectors. I need to plot surface instead. But could not work it out using surf. Please suggest.
Thanks.
for th=0:.1:2*pi
for fi=0:0.1:pi
fn4= 1/(4*pi)*(F1111*(cos(th)*sin(th))^4 + F1122 *(cos(th)*cos(fi))^2*(sin(th)*cos(fi))^2+...........continues.......)
[X,Y,Z] = sph2cart(th,fi,fn4);
scatter3(X,Y,Z,'.r');
hold on;
end
end

採用された回答

KSSV
KSSV 2018 年 1 月 22 日
clc; clear all ;
th=0:.1:2*pi ;
fi=0:0.1:pi ;
XX = zeros(length(th),length(fi)) ;
YY = zeros(length(th),length(fi)) ;
ZZ = zeros(length(th),length(fi)) ;
for i = 1:length(th)
for j = 1:length(fi)
fn4= 1/(4*pi)*(F1111*(cos(th(i))*sin(th(i)))^4 + F1122 *(cos(th(i))*cos(fi(j)))^2*(sin(th(i))*cos(fi(j)))^2 +...........continues.......)
[X,Y,Z] = sph2cart(th(i),fi(j),fn4);
scatter3(X,Y,Z,'.r');
hold on;
XX(i,j) = X ; YY(i,j) = Y ; ZZ(i,j) = Z ;
end
end
Now use surf on XX,YY and ZZ
  1 件のコメント
Ashbub
Ashbub 2018 年 1 月 22 日
Thankyou so much!! Here how it looks like. Beautiful, isn't it?

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

その他の回答 (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