surface plot for multiple vector points
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Akzeptierte Antwort
KSSV
am 22 Jan. 2018
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!