漂亮,美观的图表之Matlab强势回归~~~~走你8

今天来画3D plot

% Load the data
load latticeExample
xx = x(:);yy = y(:);zz = z(:);
% locate the non-zero points
a = find(T~=0);
% plot the non-zero points using a scatter plot
% use the values of T to represent both color and size of symbols
scatter3(xx(a),yy(a),zz(a),1000*T(a),T(a),'filled');
% set the view
view(3); 


 

 

 

 

 

接下来STREAM SLICE;

%% Generate the data
% define the grid
x_lim=.8; y_lim=.8; z_lim=.8; step=.01;
x=[-x_lim:step:x_lim]; y=[-y_lim:step:y_lim]; z=[-z_lim:step:z_lim];
[x y z]=meshgrid(x,y,z);r=sqrt(x.^2+y.^2+z.^2);
%generate the data
cos_theta=z./r; sin_theta=sqrt(1-(cos_theta).^2); % These are the angles made by the x,y,z axes 
cos_phi=x./sqrt(x.^2+y.^2); sin_phi=y./sqrt(x.^2+y.^2);
V_dip_ang=cos_theta; %only the angular dependence of the radiation pattern is considered  
theta_hat_x=cos_theta.*cos_phi; theta_hat_y=cos_theta.*sin_phi; theta_hat_z=-sin_theta; % theta_hat direction resolved in x,y, and z directions
r_hat_x=sin_theta.*cos_phi; r_hat_y=sin_theta.*sin_phi; r_hat_z=cos_theta; %r_hat direction resolved in x,y, and z directions    
E_ang_x=2*cos_theta.*r_hat_x + sin_theta.*theta_hat_x; %x component of the electric field (only the angular pattern)
E_ang_y=2*cos_theta.*r_hat_y + sin_theta.*theta_hat_y; %y component of the electric field
E_ang_z=2*cos_theta.*r_hat_z + sin_theta.*theta_hat_z; %z component of the electric field
E_ang=sqrt(E_ang_x.^2+E_ang_y.^2+E_ang_z.^2); % The magnitude of the electric field

%% Plotting the absolute value of the potential and the magnitude of the electric field distribution on a spehere
% plot the data
streamslice(x,y,z,E_ang_x,E_ang_y,E_ang_z,[-.3 .1],[],[]); % This is used for vector data  
% set the view
campos([-3,-15,5])
box on
% set the background and tick colors
set(gca,'Color',[.8,.8,.8],'XColor','black', ...
	'YColor','black','ZColor','black')
%annotate
title({'Visualizing the electric field pattern of a ',...
      'dipole antenna using \color{red}streamslice'},'Fontsize',14)


 

 

 

今天时间有点紧,,就先这些吧。。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]:在MATLAB中,使用~符号可以表示逻辑非操作,即取反。例如,a(i)~=0表示数组a中索引为i的元素不等于0。\[1\]这个操作可以用于筛选数组中不等于0的元素。 引用\[2\]:在MATLAB中,可以使用sum函数来计算两个矩阵中相同像素值的总数。比如,比较矩阵A和矩阵B,可以使用sum(sum(A == B))来计算两个矩阵相同像素的数量。\[2\] 引用\[3\]:另外,MATLAB中的逻辑与操作符&&也是非常有用的。如果A是一个计算量较小的函数,而B是一个计算量较大的函数,使用A&&B可以先判断A的结果,如果A为真,则继续计算B,否则可以避免不必要的计算量。此外,逻辑与操作符也可以用于防止类似被0除的错误。\[3\] 综上所述,在MATLAB中,使用~可以表示逻辑非操作,sum函数可以计算两个矩阵中相同像素值的总数,而逻辑与操作符&&可以用于条件判断和减少计算量。 #### 引用[.reference_title] - *1* [Matlab数组中符号“~”的使用](https://blog.csdn.net/qq_42680785/article/details/115904553)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [matlab中==、~=、&&的含义](https://blog.csdn.net/m0_68190620/article/details/126057313)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值