define an array in equation
이전 댓글 표시
pi2=2*pi;
k=14e12;
fc=55e6;
tp=5e-6;
D=-tp/2:0.1e-6:tp/2;
tau=(D);
I have an array element tau.
I need to put this into an equation. so, i wrote the code as
Stx(tau)=(exp(1j*pi2*((fc*tau)+((k*(tau^2))/2))));
but it showed me error:
Subscript indices must either be real positive integers or logicals.
Error in ==> factorized1 at 37
Stx(tau(D))=floor(exp(1j*pi2*((fc*tau)+((k*(tau.^2))/2))));
so how can i define it?
답변 (2개)
Walter Roberson
2013년 4월 7일
You cannot define "equations" in MATLAB except in the symbolic toolbox.
Try
Stx= @(tau) (exp(1j*pi2*((fc*tau)+((k*(tau^2))/2))));
and then Stx would become a function that you could pass tau to and get a result from.
Youssef Khmou
2013년 4월 7일
편집: Youssef Khmou
2013년 4월 7일
hi, try directly :
Stx=(exp(1j*pi2*((fc*tau)+((k*(tau.^2))/2))));
plot(real(Stx))
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!