⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spiral_dyn.m

📁 本文是关于粒子群算法(pso)的介绍和相关MATLAB源程序,是智能天线权值优化方面的一种很前沿的算法
💻 M
字号:
% spiral_dyn.m
% returns x,y position along an archimedean spiral of degree n
% based on cputime, first time it is called is start time
%
% based on: r = a*(theta^n)
%
% usage: [x_cnt,y_cnt] = spiral_dyn(n,a)
% i.e., 
%   n =  2 (Fermat)
%     =  1 (Archimedes)
%     = -1 (Hyberbolic)
%     = -2 (Lituus)

% Brian Birge
% Rev 1.1
% 8/23/04

function [x_cnt,y_cnt] = spiral_dyn(n,a)
 % this keeps the same start time for each run of the calling function 
 % this will reset when any calling prog is re-saved or workspace is
 % cleared
  persistent tnot iter
 % find starting time
  if ~exist('tnot') | length(tnot)==0
     tnot = cputime;
   %  iter = 0;
  end
  %iter = iter+10 ;
  
 theta = cputime-tnot;
 %theta = iter/10000;
 
 r = a*(theta.^n);
 
 x_cnt = r*cos(theta);
 y_cnt = r*sin(theta);
 return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -