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
How to make a curve smooth?
Started by ●June 18, 2005
Reply by ●June 20, 20052005-06-20
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
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
Reply by ●June 20, 20052005-06-20
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
> 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
Reply by ●June 20, 20052005-06-20
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.
in your Gaussian noise formula use the values of SNR2 and then you will get smmother curves.
regards
khmaies
Reply by ●June 21, 20052005-06-21
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 __________________________________________________
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 __________________________________________________
Reply by ●June 23, 20052005-06-23
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:
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
__________________________________________________