How to make a curve smooth?

Started by Heart To Heart June 18, 2005
Hello,
I am plotting SNR ~ BER with a limited number of points i.e I have 2 series of data [x] and [y]
Now I want to make it a smooth curve of the plot(x,y) (just like in Excel). Anyone know how to do that?
Thanks alot!

HTH



Try to use the Polyfit command, uses the least sq method.

FROM HELP:
p = polyfit(x,y,n) finds the coefficients of a polynomial p(x) of
degree n that fits the data, p(x(i)) to y(i), in a least squares
sense. The result p is a row vector of length n+1 containing the
polynomial coefficients in descending powers.....

I hope this will answer your question!

Regards,
Sohaib.

--- In matlab@matl..., Heart To Heart <heart2heart090@y...>
wrote:
> Hello,
> I am plotting SNR ~ BER with a limited number of points i.e I have
2 series of data [x] and [y]
> Now I want to make it a smooth curve of the plot(x,y) (just like
in Excel). Anyone know how to do that?
> Thanks alot!
>
> HTH


El 18/06/2005, a las 16:30, Heart To Heart escribi

> I am plotting SNR ~ BER with a limited number of points i.e I have
> 2 series of data [x] and [y]
> Now I want to make it a smooth curve of the plot(x,y) (just like in
> Excel).

The smoothing in Excel is made via splines: you take 3rd degree
polynomials, and adjust their four coefficients with the need of
continuity, and smooth 1st and 2nd order derivatives. Then you would
have to create sufficient points from those polynomials, so that you
can see the curve really smoothed.

MATLAB implements the spline command.

Try "help spline" to see how it works.

--
Juan de Dios Santander Vela
BS in Physics, Master in Electronic Engineering
D.Sc. Student on Multimedia Technologies
Instituto de Astrofica de Andaluc Pre-doctoral Contract



Hi there,
 
SNR values are usually presented in dB. So you scale should be in logarithmetic scale. Here you have to use semilogxy function instead of plot(x,y), check the function with help.
To get smoother curves you suppose that you have two values of SNR:
1- the one with dB values SNR1=1,2,3,.....20,...
2-SNR2^((SNR1)/10)
in your Gaussian noise formula use the values of SNR2 and then you will get smmother curves.
regards
khmaies


Hello,

Thanks guys for your advice, finally, it is done with just 3 commands below.

Cheers,
HTH

1. polycoefficient = polyfit(EbN0db,log10(ber_itn+10^(-30)),2);
%Find the coefficents of a polynomial of order 2
% to approximate log10(ber) of each iteration
%10^(-30) to make ber_itn non-zero
2. poly_ber = 10.^polyval(polycoefficient,EbN0db);
%Approximate log10(ber) of each iteration using the above coefficents
3. semilogy(EbN0db,poly_ber,'-',EbN0db,ber_itn,'+'); grid on
%plot both actual data and approximated data
hold on; khmaies ouahada <khmaies@khma...> wrote:
Hi there,

SNR values are usually presented in dB. So you scale should be in logarithmetic scale. Here you have to use semilogxy function instead of plot(x,y), check the function with help.
To get smoother curves you suppose that you have two values of SNR:
1- the one with dB values SNR1=1,2,3,.....20,...
2-SNR2^((SNR1)/10)
in your Gaussian noise formula use the values of SNR2 and then you will get smmother curves.
regards
khmaies

To
___________________________________________________________

If I have 3 letters: H, R, T.
I can add E, A to have HEART,
I can also add U to get HURT.
But:
I'd rather have U and get HURT than having a HEART without U __________________________________________________



Hi!
 
Great to see the solution also, other wise most of the time, only problems where seen & no solution, after long time. Thanks Heart to share the solution.
 
Regards,
 
Sohaib.

Heart To Heart <h...@yahoo.com> wrote:
Hello,

Thanks guys for your advice, finally, it is done with just 3 commands below.

Cheers,
HTH

   1. polycoefficient = polyfit(EbN0db,log10(ber_itn+10^(-30)),2);
        %Find the coefficents of a polynomial of order 2
        % to approximate log10(ber) of each iteration
        %10^(-30) to make ber_itn non-zero
    2.  poly_ber = 10.^polyval(polycoefficient,EbN0db);
        %Approximate log10(ber) of each iteration using the above coefficents
    3.  semilogy(EbN0db,poly_ber,'-',EbN0db,ber_itn,'+'); grid on
        %plot both actual data and approximated data  
    hold on;khmaies ouahada <k...@gmail.com> wrote:
Hi there,

SNR values are usually presented in dB. So you scale should be in logarithmetic scale. Here you have to use semilogxy function instead of plot(x,y), check the function with help.
To get smoother curves you suppose that you have two values of SNR:
1- the one with dB values SNR1=1,2,3,.....20,...
2-SNR2^((SNR1)/10)
in your Gaussian noise formula use the values of SNR2 and then you will get smmother curves.
regards
khmaies

   To
___________________________________________________________

If I have 3 letters: H, R, T.
I can add E, A to have HEART,
I can also add U to get HURT.                       
But:
I'd rather have U and get HURT than having a HEART without U__________________________________________________
/


NEW!  You can now post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/matlab/1.php

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

Archives:  http://www.dsprelated.com/groups/matlab/1.php

To Post:  Send an email to m...@yahoogroups.com

Other DSP Related Groups: http://www.dsprelated.com/groups.php




Regards,

Sohaib Zia Khan.

Reply to me: s...@hotmail.com & j...@yahoo.com

For NEDianz only: http://groups.yahoo.com/group/nedmech9798

__________________________________________________

Hi!
 
Great to see the solution also, other wise most of the time, only problems where seen & no solution, after long time. Thanks Heart to share the solution.
 
Regards,
 
Sohaib.

Heart To Heart <h...@yahoo.com> wrote:
Hello,

Thanks guys for your advice, finally, it is done with just 3 commands below.

Cheers,
HTH

   1. polycoefficient = polyfit(EbN0db,log10(ber_itn+10^(-30)),2);
        %Find the coefficents of a polynomial of order 2
        % to approximate log10(ber) of each iteration
        %10^(-30) to make ber_itn non-zero
    2.  poly_ber = 10.^polyval(polycoefficient,EbN0db);
        %Approximate log10(ber) of each iteration using the above coefficents
    3.  semilogy(EbN0db,poly_ber,'-',EbN0db,ber_itn,'+'); grid on
        %plot both actual data and approximated data  
    hold on;khmaies ouahada <k...@gmail.com> wrote:
Hi there,

SNR values are usually presented in dB. So you scale should be in logarithmetic scale. Here you have to use semilogxy function instead of plot(x,y), check the function with help.
To get smoother curves you suppose that you have two values of SNR:
1- the one with dB values SNR1=1,2,3,.....20,...
2-SNR2^((SNR1)/10)
in your Gaussian noise formula use the values of SNR2 and then you will get smmother curves.
regards
khmaies

   To
___________________________________________________________

If I have 3 letters: H, R, T.
I can add E, A to have HEART,
I can also add U to get HURT.                       
But:
I'd rather have U and get HURT than having a HEART without U__________________________________________________
/


NEW!  You can now post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/matlab/1.php

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

Archives:  http://www.dsprelated.com/groups/matlab/1.php

To Post:  Send an email to m...@yahoogroups.com

Other DSP Related Groups: http://www.dsprelated.com/groups.php




Regards,

Sohaib Zia Khan.

Reply to me: s...@hotmail.com & j...@yahoo.com

For NEDianz only: http://groups.yahoo.com/group/nedmech9798

__________________________________________________

Hello,

Thanks guys for your advice, finally, it is done with just 3 commands below.

Cheers,
HTH

1. polycoefficient = polyfit(EbN0db,log10(ber_itn+10^(-30)),2);
%Find the coefficents of a polynomial of order 2
% to approximate log10(ber) of each iteration
%10^(-30) to make ber_itn non-zero
2. poly_ber = 10.^polyval(polycoefficient,EbN0db);
%Approximate log10(ber) of each iteration using the above coefficents
3. semilogy(EbN0db,poly_ber,'-',EbN0db,ber_itn,'+'); grid on
%plot both actual data and approximated data
hold on; khmaies ouahada <khmaies@khma...> wrote:
Hi there,

SNR values are usually presented in dB. So you scale should be in logarithmetic scale. Here you have to use semilogxy function instead of plot(x,y), check the function with help.
To get smoother curves you suppose that you have two values of SNR:
1- the one with dB values SNR1=1,2,3,.....20,...
2-SNR2^((SNR1)/10)
in your Gaussian noise formula use the values of SNR2 and then you will get smmother curves.
regards
khmaies

To
___________________________________________________________

If I have 3 letters: H, R, T.
I can add E, A to have HEART,
I can also add U to get HURT.
But:
I'd rather have U and get HURT than having a HEART without U __________________________________________________



Hi there,
 
SNR values are usually presented in dB. So you scale should be in logarithmetic scale. Here you have to use semilogxy function instead of plot(x,y), check the function with help.
To get smoother curves you suppose that you have two values of SNR:
1- the one with dB values SNR1=1,2,3,.....20,...
2-SNR2^((SNR1)/10)
in your Gaussian noise formula use the values of SNR2 and then you will get smmother curves.
regards
khmaies


El 18/06/2005, a las 16:30, Heart To Heart escribi

> I am plotting SNR ~ BER with a limited number of points i.e I have
> 2 series of data [x] and [y]
> Now I want to make it a smooth curve of the plot(x,y) (just like in
> Excel).

The smoothing in Excel is made via splines: you take 3rd degree
polynomials, and adjust their four coefficients with the need of
continuity, and smooth 1st and 2nd order derivatives. Then you would
have to create sufficient points from those polynomials, so that you
can see the curve really smoothed.

MATLAB implements the spline command.

Try "help spline" to see how it works.

--
Juan de Dios Santander Vela
BS in Physics, Master in Electronic Engineering
D.Sc. Student on Multimedia Technologies
Instituto de Astrofica de Andaluc Pre-doctoral Contract



Try to use the Polyfit command, uses the least sq method.

FROM HELP:
p = polyfit(x,y,n) finds the coefficients of a polynomial p(x) of
degree n that fits the data, p(x(i)) to y(i), in a least squares
sense. The result p is a row vector of length n+1 containing the
polynomial coefficients in descending powers.....

I hope this will answer your question!

Regards,
Sohaib.

--- In matlab@matl..., Heart To Heart <heart2heart090@y...>
wrote:
> Hello,
> I am plotting SNR ~ BER with a limited number of points i.e I have
2 series of data [x] and [y]
> Now I want to make it a smooth curve of the plot(x,y) (just like
in Excel). Anyone know how to do that?
> Thanks alot!
>
> HTH


Hello,
I am plotting SNR ~ BER with a limited number of points i.e I have 2 series of data [x] and [y]
Now I want to make it a smooth curve of the plot(x,y) (just like in Excel). Anyone know how to do that?
Thanks alot!

HTH