help me in understanding the code LIKE INLINE ,TMP ,PDF etc

clear,
clc;
pdf='exp(-(x-m).^2/2/sigma^2)/sqrt(2*pi)/sigma'; %Gaussian pdf of x
xf=inline(['x.*' pdf],'x','m','sigma');
f=inline(pdf,'x','m','sigma');
m=0; sigma=1; % Mean and variance of the random variable x
b0=-3; bN=3; % Given least/greatest value of the random variable x
for N=5:6 % Number of quantization intervals
delta=(bN-b0)/N;
b=b0+[0:N]*delta;
msqe=0; % Mean-Square Quantization Error
for i=1:N % Centroid of each interval
tmp1=quad(xf,b(i),b(i+1),0.01,[],m,sigma);
tmp2=quad(f,b(i),b(i+1),0.01,[],m,sigma);
tmp=tmp1/tmp2; c(i)=tmp; % Eq.(4.1.1)
x2f=inline(['(x-tmp).^2.*' pdf],'x','m','sigma','tmp');
msqe=msqe+quad(x2f,b(i),b(i+1),0.01,[],m,sigma,tmp); % Eq.(4.1.2)
end
% Resulting boundary vector and centroid vector
x=b0+(bN-b0)/1000*[0:1000];
y(find(x<b(1)))=c(1); % Left-most interval
for i=1:N, y(find(b(i)<=x&x<b(i+1)))=c(i); end
y(find(x>=b(N+1)))=c(N); % Right-most interval
subplot(2,2,N-4),
plot(x,y),
hold on,
grid on % Quantization graph
m=0; sigma=1; fx=feval(f,x,m,sigma);
plot(x,fx,'r:') ;
% Resulting MSQE
end
TELL ME CODE LIKE INLINE ,TMP, SIGMA, MSQE AND delta=(bN-b0)/N; b=b0+[0:N]*delta; MEANING

3 Commenti

pls tell me meaning of all the fuction used
Duplicate is at http://www.mathworks.com/matlabcentral/answers/35542-help-me-in-understanding-the-code
Please do not open a new Question to add additional information. You can edit your existing question or add comments to it.

Accedi per commentare.

Risposte (1)

Jan
Jan il 16 Apr 2012
Please take the time to format the code as explained in the "Markup help" link on this page. It needs less than 2 seconds for you, but it makes your code less unreadable.
It can take hours to explain the meaning of all functions of your code. I could give a 20 minute presentation about "clear" already. Therefore it is unlikely, that somebody will answer this very general question - except for TMW itself: They have written the excellent Getting Started chapters in the documentation. I'm convinced that I cannot give a better introduction.
"TELL ME CODE LIKE INLINE" in uppercase means shouting a command. The "netiquette" (let your favorite search engine find an instance) explains how to post politely in a public forum. E.g. "pls" is not a good idea, except that you want to demonstrate that you are too cool to write "please". See: Answers: how-to-ask-a-question-on-answers. Most of all post the relevant code only, use formatting, ask a (one!) specific question and be polite.

1 Commento

http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab

Accedi per commentare.

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Richiesto:

il 16 Apr 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by