필터 지우기
필터 지우기

How can I do a summation of a signal.

조회 수: 12 (최근 30일)
Vijender
Vijender 2013년 10월 11일
답변: David Sanchez 2013년 10월 11일
if i have a signal y = Acos(wt) and now i want to vary my amplituded and angular frequency. like that- ∑A(i)cos(w(i)t) where i varies from any 1 to 100.
I write the code like this
t = 0:0.01:1;
A(1:length(t)) = 0;
w(1:length(t)) = 0;
for i = 1:length(t) y= A*cos(w*t) end But i get an error... please help
  댓글 수: 1
ES
ES 2013년 10월 11일
What is the errot you get?

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

채택된 답변

David Sanchez
David Sanchez 2013년 10월 11일
The way of performing a summation is this:
t = 0:0.01:1;
A(1:length(t)) = 0;
w(1:length(t)) = 0;
y = 0;
for i = 1:length(t)
y = y + A(i)*cos(w(i)*t(i))
end
But you first have to define properly the values of A and w. As it is now, they both equal zero.

추가 답변 (1개)

ES
ES 2013년 10월 11일
this should do
y= A(i)*cos(w(i)*t)
instead of
y= A*cos(w*t)
  댓글 수: 2
Vijender
Vijender 2013년 10월 11일
I tried this also but i think my concept is wrong. Actually i want to sum my periodic signal with varying amplitude and frequency but in this code i defined the W and A with zero matrix so my Y is always zero. so what i can do for this.
Vijender
Vijender 2013년 10월 11일
I have done this...the code should be like this t = 0:0.01:1; A(1:length(t)) = 1:101; w(1:length(t)) = 1:101; %k(1:length(t)) = 0; for i = 1:length(t) y = A(i)*cos(w(i)*t) end

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by