Technical discussion about Matlab and issues related to Digital Signal Processing.
Post a new Thread
How to make a curve smooth? - Heart To Heart - Jun 18 10:30:00 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

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: How to make a curve smooth? - Sohaib Zia Khan - Jun 20 8:51:00 2005
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

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: How to make a curve smooth? - Juan de Dios Santander Vela - Jun 20 9:10:00 2005
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 Astrofísica de Andalucía — Pre-doctoral Contract

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: How to make a curve smooth? - khmaies ouahada - Jun 20 10:14:00 2005
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=10^((SNR1)/10)
in your Gaussian noise formula use the values of SNR2 and then
you will get smmother curves.
regards
khmaies

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: How to make a curve smooth? It is done! - Heart To Heart - Jun 21 17:46:00 2005
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=10^((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
__________________________________________________
">http://mail.yahoo.com

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: How to make a curve smooth? It is done! - Sohaib Zia Khan - Jun 23 6:10:00 2005
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=10^((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__________________________________________________
/">http://mail.yahoo.com
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
_____________________________________
/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
__________________________________________________

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )