Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1082
Number of posts: 1715

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Calculate-Electrolytes Average value Posted by naturephoenix on 18 Jan 2012 at 6:26 AM
Hey all, I need to do next task:

Write a function which calculates a Electrolytes Average value.
Input data are:
1.sampled signal (vector)
2.sampling rate
3.frequency of first harmonic.
This is my solution, and I am not sure is it good.

My problem is cuz I dont use first harmonic's frequency at all, that's why I am not sure in mine solution

function Yavg=el_avg_val(y,f_s,f_o)
fmax=f_s/2;
max=1/fmax;
%I read that 10 points per max frequency's period is good enough to recognize a signal

delta=max/10;
t=0:delta:max;
N=length(t);
Yavg=sum(abs(y)/N)
end

My second slution:

function Yavg=el_avg_val(y,f_s,f_o)

t=0:1/f_s:1_f_o;
N=length(t);
Yavg=sum(abs(y)/N)
end



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.