hi i want to save the values of a vector in a xls file. The value s change inside a for loop... the variable is avg_rayleigh
clc
syms k s=sqrt(2/pi); m=2; w=4.527; S=1; sigma=1.42558; s_chi=0.42552; freq=[100:100:700]'
for i=100:100:700 freq=i; f=i*1e6;
[hm,P,er,k0,beta,er_eff,L]=parameter(f);
r=sqrt(er_eff)./er; theta=2*pi/5;
phi=3*pi/7; %phid=acosd(r.*sin(theta)) distr='Rayleigh' %coifficients [d1,d2]=coifp(k0,beta,L,er_eff,er,theta,phi);
d=d2;
if strcmp(distr,'Rayleigh') y=(sqrt(2/pi)*P*s*d)*1e3;
avg_rayleigh=[freq y]
%xlswrite('resultsmean.xls',avg_rayleigh,'sheet1','A1','B1') %xlswrite('out.xls',freq','sheet1','A1') %xlswrite('out.xls',avg_rayleigh(:,1),'sheet1','A1') %xlswrite('out.xls',avg_rayleigh(:,2),'sheet1','B1')
elseif strcmp(distr,'chi')
y=((15/8)*sqrt(2/pi)*s_chi*d*P)*1e3;
avg_chi=[freq y];
elseif strcmp(distr,'nakagami') y=((2/pi)*P*d*sqrt(w/m)*(gamma(m+1/2)/gamma(m)))*1e3;
avg_nakagami=[freq(i) y]
elseif strcmp(distr,'rician')
A=S/(sqrt(2)*sigma); I=(2*sqrt(2)/pi)*P*d*sigma*exp(-S^2/(2*sigma^2)); r=factorial(k); y=(I*vpa(symsum( A^(2*k)*gamma(k+3/2)/(r^2),0,inf),4))*1e3;
avg_rician=[freq y];
end end

 채택된 답변

Stalin Samuel
Stalin Samuel 2017년 1월 21일

0 개 추천

here you can see the Example code which has the solution

댓글 수: 1

thank you.... i have use the num2str it is more simpel thna the printf.. but i cant find a similar example

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by