Data transmission from node to a gateway
4 views (last 30 days)
Show older comments
Hi,
I am creating a wireless sensor network in Matlab in which nodes transmit information to the central gateway which then processes this information for analysis. I want to know
- How can I code this transmission in which a node transmits some amount of data to the gateway (say 1000kB at 250kBps) and gateway receives that transmission?
- The transmission should also be timed such that the delay experienced by rest of the nodes while in queue is calculated.
Thanks in advance for any suggestions and help.
0 Comments
Answers (1)
Deepanshu Udhwani
on 30 Nov 2017
Edited: Walter Roberson
on 30 Nov 2017
e:\Bisection.txt
************************************************************************
clc;
clear all;
a=input('Initial point ');
b=input('Final Point ');
c=(a+b)/2;
f=@(x) x^3+4*(x^2)-10;
E=0.001;
ceil(n=(log(b-a)-log(E))/log(2))
while(abs(a-b)>E)
if f(a)*f(c)<0
b=c;
else
a=c;
end;
c=(a+b)/2;
end;
c
e:\Fixed_Point_Iteration.txt
************************************************************************
clc;
clear all;
a=input("a");
b=input('b');
%x0=(a+b)/2;
x0=1;
E=0.001;
N=ceil((log(b-a)-log(E))/(log(2)));
i=1;
g=@(x) x-((2*sin(3.14*x)+x)/(1+(2*3.14*cos(3.14*x)))); %Newton Method to find g(x);
while i<=N
xx=g(x0);
if(abs(xx-x0)<E)
break;
end;
x0=xx;i=i+1;
end;
xx
e:\Guass_Elimination.txt
************************************************************************
clc;
clear all;
n=input('N: ');
for i=1:n
for j=1:n+1
A(i,j)=input('Enter element');
end;
end;
for i=1:n-1
for j=i+1:n
m=A(j,i)/A(i,i);
for k=1:n+1
A(j,k)=A(j,k)-m*A(i,k);
end;
end;
end;
X(n)=A(n,n+1)/A(n,n);
for i=(n-1):-1:1
sum=0;
for j=i+1:n
sum=sum+(A(i,j)*X(j));
end;
X(i)=(A(i,n+1)-sum)/A(i,i);
end;
A
X
e:\GuassSeidal.txt
************************************************************************
clc;
clear all;
n=input('N ');
E=0.0001;
for i=1:n
for j=1:n+1
A(i,j)=input('Enter element');
end;
end;
for i=1:n
X(i)=0;
Xold(i)=0;
end;
sum=0;
normval=2;
while abs(normval)>E
Xold=X;
for i=1:n
for j=1:n
if j!=i
sum=sum+A(i,j)*X(j);
end;
end;
X(i)=(A(i,n+1)-sum)/A(i,i);
sum=0;
end;
normval=norm(Xold-X,inf);
end;
X
e:\Lagrange_Interpolation.txt
************************************************************************
% Q3
clc;
clear all;
n=input('N: ');
f=@(x) exp(2*x)*cos(3*x);
for i=1:n
X(i)=input('Enter X: ');
%Y(i)=input('Enter Y: ');
Y(i)=f(X(i));
l(i)=1;
end;
p=input('Enter the value of X where value is to be calculated');
for i=1:n
for j=1:n
if i!=j
l(i)=((p-X(j))/(X(i)-X(j)))*l(i);
end;
end;
end;
sum=0;
for i=1:n
sum=sum+l(i)*Y(i);
end;
sum
e:\Newton.txt
************************************************************************
clc;
clear all;
a=input('a ');
E=0.0001;
f=@(x) cos(x)-(x*exp(x));
g=@(x) -sin(x)-(x*exp(x)+exp(x));
while(true)
b=a-(f(a)/g(a));
if(abs(b-a)<=E)
break;
end;
a=b;
end;
b
e:\Newton_Divided_Difference_Interpolation.txt
************************************************************************
clc;
clear all;
n=input('N ');
p=input('p ');
for i=1:n
X(i)=input('X');
Y(i)=input('Y');
end;
for i=1:n
F(1,i)=Y(i);
end;
for i=2:n
for j=i:n
F(i,j)=(F(i-1,j)-F(i-1,j-1))/(X(j)-X(j-i+1));
end;
end;
for i=1:n
product(i)=1;
for j=1:(i-1)
product(i)=product(i)*(p-X(j));
end;
end;
F=transpose(F);
sum=0;
for i=1:n
sum=sum+F(i,i)*product(i);
end;
sum
e:\Power_Method.txt
************************************************************************
clc;
clear all;
n=input('N: ');
E=0.001;
for i=1:n
for j=1:n
A(i,j)=input('Enter Element');
end;
end;
for i=1:n
X(i)=input('Element');
end;
X=transpose(X);
Y=A*X;
K=norm(Y,inf);
Kdash=100;
X=(1/K)*Y;
while abs(K-Kdash) >E
Y=A*X;
Kdash=K;
K=norm(Y,inf);
X=(1/K)*Y;
end;
K
X
e:\RungeKutta.txt
************************************************************************
clc;
clear all;
a=input('a ');
b=input('b ');
h=input('h ');
n=(b-a)/h;
f=@(t,y) -y+(2*cos(t));
t0=0;y0=1;
for i=1:n
k1=h*f(t0,y0);
k2=h*f((t0+(h/2)),(y0+(k1/2)));
k3=h*(f((t0+(h/2)),(y0+(k2/2))));
k4=h*(f(t0+h,y0+k3));
y1=y0+(1/6)*(k1+2*k2+2*k3+k4);
y0=y1;
t0=t0+h;
end;
y1
e:\Secant.txt
************************************************************************
clc;
clear all;
a=input('a ');
b=input('b ');
c=0;
E=0.0001;
f=@(x) x^2-17;
while(abs(b-a)>E)
c=b-((b-a)/(f(b)-f(a)))*f(b);
if(f(c)==0)
break;
end;
a=b;
b=c;
end;
b
e:\Simpson.txt
************************************************************************
clc;
clear all;
a=input('a ');
b=input('b ');
N=input('N ');
h=(b-a)/N;
f=@(x) 1/(x*log(x));
sum=0;
for i=1:N-1
x=a+(i*h);
if i%2==0
sum=sum+(2*f(x));
else
sum=sum+(4*f(x));
end;
sum=(sum+f(a)+f(b));
end;
sum*(h/3)
e:\Trepozoidal.txt
************************************************************************
clc;
clear all;
a=input('a ');
b=input('b ');
N=input('N ');
h=(b-a)/N;
f=@(x) cos(x)*cos(x);
sum=0;
I=0;
for i=1:N-1
x=a+(i*h);
sum=sum+(2*f(x));
% Sum starts as Sigma i=1 to N-1 because f(a) and f(b) are adjusted later
end;
sum=sum+(f(a)+f(b));
sum*(h/2)
% I= h/2 * ( f(a) +f(b) ) + h*( sigma i=1 to N-1 f(a+h*i) )
4 Comments
Walter Roberson
on 31 Dec 2020
newton central difference has nothing to do with data transmission between nodes; you should be asking in your own Question. http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
See Also
Categories
Find more on Labyrinth problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!