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.

calculate the amplitude of sin signal ??

Status
Not open for further replies.
how we can calcaulate the parameters of signals

awaili said:
sorry , but i'm looking for matlab code that can be used to calculate the amplitude and the frequency of sin signal...
if any one has any idea about it code you help me to write this code .....plz

thanks

Go though all the above posts, its carrying enough information to make those calculations. You've to do your homework though...
 

rms dc offset calculate

gameelgamal “calculate the amplitude of sin signal ??”

Hello!
You could use one ADC to calculate all the parameters on the sinusoidal signal (SS) with or without displacement (DC offset).
You must take 4 samples per cycle of the SS (not necessarily at equal intervals, but you must know the intervals).
You should make a system with four equations using the formula below:

A = Am*sin(2*pi*Fss*t + phase) + DC

If you need parameters which are not in the formula above, you could apply the standard formulas in mathematics concerning sinusoidal signal.
I hope that is easy and useful for you.
BR
 

calculate offset sinusoidal

Jack// ani wrote:
Wrote a little code on CCS PIC, nothing fancy standard deviation with 30 samples at work as discussed by FvM.

Have run out of 16F877A, so couldn't burnt and tested it. Any comments, mistakes, improvements are always appreciated...

#include <16F877A.h>
#device ADC=10
#include <math.h>
#fuses XT,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)

void main()
{

int16 value, samples[29]; //Value is a 10bit data sample
int i;
float volts;
setup_port_a(ALL_ANALOG); // All the 8 channels are analog
setup_adc(ADC_CLOCK_INTERNAL); // Internal ADC Clock
set_adc_channel(0); // RA0/AN0(Pin2) is analog input channel

while(1)
{
for(i=0;i<=29;i++)
{
samples=read_adc();
delay_us(666);
}

//SQUARE OF SAMPLES
for(i=0;i<=29;i++)
{
samples=samples*samples; // Sqaure
value=samples+value; // Sum total
}

value = value/30; // Mean of 30 samples
value = sqrt(value); // Square root

volts=(float)value*0.0048828125; // 1024 discrete levels, 5/1024 = 0.0048828125
printf("Voltage is : %3.3f\n",volts);// Print upto 3 decimal places
delay_ms(500);
}
}



I would like to add a few things
1- I suggest initialize "vaue" variable to 0
2- Do following to get rid of dc level in the signal(for example if the signal has been biased)
a. DC_Average = sumOfSample/NoOfSamples
b. For each sample samples = PositiveValueOf(samples - DC_Average)
c. Do the rest as in //SQUARE OF SAMPLES


Dear All

The above information is usefull to me . Can i have more details about the point(b)

Please say me in details what i should with DC Average and what would be the value.

Please say me in detail

And if i have a variable Frequency how could i sample the amplitude.

Waiting for u reply
Regards
Prabakaran
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top