필터 지우기
필터 지우기

Assigning computation values to variables without making it an array

조회 수: 1 (최근 30일)
Alex Vasin
Alex Vasin 2019년 4월 12일
답변: Kevin Rawson 2019년 4월 12일
Hi. When I use the following code it creates a array instead of just store a single value.
fa1=(1/T)*trapz(t1,f1);
How do I sotre just the value, since when I try rping the answer it prints an entire matrix
  댓글 수: 2
madhan ravi
madhan ravi 2019년 4월 12일
Provide the missing values
Alex Vasin
Alex Vasin 2019년 4월 12일
T=2*pi;
w0=1
t1=-pi:0.001:0;
f1=-(t1/pi);
t2=-0:0.001:pi;
f2=t2.*cos(3*t2);
fa1=(1/T)*trapz(t1,f1);
fa2=(1/T)*trapz(t2,f2);
sum1=fa1;
sum2=fa2;
for n=1:10
sum1=sum1+((1/T)*trapz(t1,f1.*exp(-1j*n*w0.*t1))).*exp(1j*n*w0.*t1)...
+((1/T)*trapz(t1,f1.*exp(1j*n*w0.*t1))).*exp(-1j*n*w0.*t1);
sum2=sum2+((1/T)*trapz(t2,f2.*exp(-1j*n*w0.*t2))).*exp(1j*n*w0.*t2)...
+((1/T)*trapz(t2,f2.*exp(1j*n*w0.*t2))).*exp(-1j*n*w0.*t2);
disp([num2str(sum1+sum2)])
end

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

답변 (1개)

Kevin Rawson
Kevin Rawson 2019년 4월 12일
I suggest you check what terms are enclosed in your parentheses very closely.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by