Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Definite sum in MATLAB

Status
Not open for further replies.

Mona7150

Member level 1
Member level 1
Joined
Nov 9, 2013
Messages
35
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
249
Hello all,

I have a parameter in frequency domain say x(f) calculated for 0 to 100GHz but I want to sum up the x's from 50 to 60 GHz only. How should I write this in MATLAB?
 

Hallo,

if f is the frequency array and X(f) your signal

startFreqIdx = find(X >= F_0, 1 ); % the first index of X(f) with frequency f>= F_0
stopFreqIdx = find(X <= F_1, 1, 'last' ); % the last index of X(f) with frequency f<= F_1

S = sum(X(startFreqIdx : stopFreqIdx ))

This should work (precondition: f axes has been assumed in increasing order)

Mowgli
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top