EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
用function写了一个函数,希望能够输出两个不同的数组,如[a,b]=fun(x),其中a,b为两个不同的数组,但是貌似b会将a的结果覆盖,得到的ans只有一个数组。程序如下:
% z, `* O0 I# d L5 l
function [thta,y]=Sa(N) if N>=10000; # ^/ J, }5 G6 ^; P3 B& I" s
error('input must smaller than 10000')
9 ~# Q$ R5 C# A6 ~( }
end tht=0:pi/9999:pi; d=floor(10000/N); y=[]; thta=[]; for i=0:N-1; a=1+i*d; thta=[thta,tht(a)]; y=[y,(sin((N/2)*pi*(cos(tht)-cos(thta(i+1)))))/(N*sin((pi/2)*(cos(tht)-cos(thta(i+1)))))]; end end
2 R3 k" a' f/ Q
, C! g# q1 L1 k* D$ O
/ L- ?" n6 b. I8 ?0 @+ F( R 9 ]* C, G* {7 O, K$ b
/ F9 z( Z, j9 w) A5 I |