4.83333

4.8 | 6 ratings Rate this file 29 Downloads (last 30 days) File Size: 6.72 KB File ID: #20209
image thumbnail

2D Multiwall model

by

 

08 Jun 2008 (Updated )

A fast implementation of the Multiwall model

| Watch this File

File Information
Description

Compute 2D - MultiWall model
 
Usage
------
 
rs_amp = multiwall_model(TXpoint , RXpoint , walls , material , [L0] , [n]);
 
 
Inputs
-------
 
TXpoint Transmitter points (2 x Nt)
RXpoint Receiver points (2 x Nr)
walls Walls (4 x nwall) where [xi,0 ; yi,0 ; xi,1 ; yi,1] are coordinates of the i'th wall, i = 1,...,nwall.
material Material (2 x nwall) where [typei ; ni] reprensents type of wall and associated attenuation index, i = 1,...,nwall.
L0 Reference loss value at 1m (L0 = 40.2 default)
n Power decay factor (n = 2 default)
 
Outputs
-------
rs_amp Total power (Nt x Nr)

Compilation instruction : Please run mexme_multiwall_model
------------------------------

Run mexme_multiwall_model for compile the mex file (please be sure that mex -setup is ok on your platform).

Run test_multiwall_model for demo.

Please open multiwall_model.c for other examples

MATLAB release MATLAB 7.5 (R2007b)
Other requirements A C compiler (At least included LCC compiler)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (43)
22 Mar 2014 Giovanny

Buenas tardes
quisiera saber de donde saco las datos para los materiales de la paredes y así mismo como representa estos datos en los valores de cada columna correspondiente a la matriz de materiales

20 Jul 2012 Michael

Mr. Paris,
I was wondering where you got the data for wall materials and the dimensions of the floor plan displayed, so if you could tell me that would be much appreciated.

-Michael

07 Jul 2012 Sebastien PARIS

Mickeal,

remove the "s" line 241 in #endifs t #endif

Stupid CTRL+S add an extra s ... somewhere. I will update with this fix. Thank u for reporting.

06 Jul 2012 Michael

Yes its puzzling me as well. Thank you for all of your help so far its much appreciated.

06 Jul 2012 Sebastien PARIS

Hummm ... it's puzzling me ...
I will check tonight when I will have access to a W764 ...

06 Jul 2012 Michael

ok, so I redownloaded all of the files and reinstalled the compiler and tried again and the same thing is happening. When I run the mex -v command, this is the error message I receive:
mex -v multiwall_model.c
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
****************************************************************************

-> Default options filename found in C:\Users\wildcat\AppData\Roaming\MathWorks\MATLAB\R2012a
----------------------------------------------------------------
-> Options file = C:\Users\wildcat\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2012a
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
OPTIMFLAGS = /O2 /Oy- /DNDEBUG
DEBUGFLAGS = /Z7
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"C:\Users\wildcat\AppData\Local\Temp\mex_IMGr2e\templib.x" /MAP:"multiwall_model.mexw64.map"
LINKDEBUGFLAGS = /debug /PDB:"multiwall_model.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"multiwall_model.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------


--> cl /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\Users\wildcat\AppData\Local\Temp\mex_IMGr2e\multiwall_model.obj -I"C:\Program Files\MATLAB\R2012a\extern\include" -I"C:\Program Files\MATLAB\R2012a\simulink\include" /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 multiwall_model.c

multiwall_model.c
multiwall_model.c(179) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(186) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(193) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(289) : fatal error C1004: unexpected end-of-file found

C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'multiwall_model.c' failed.

Error using mex (line 206)
Unable to complete successfully.

06 Jul 2012 Michael

ok, so I redownloaded all of the files and reinstalled the compiler and tried again and the same thing is happening. When I run the mex -v command, this is the error message I receive:
mex -v multiwall_model.c
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
****************************************************************************

-> Default options filename found in C:\Users\wildcat\AppData\Roaming\MathWorks\MATLAB\R2012a
----------------------------------------------------------------
-> Options file = C:\Users\wildcat\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2012a
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
OPTIMFLAGS = /O2 /Oy- /DNDEBUG
DEBUGFLAGS = /Z7
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"C:\Users\wildcat\AppData\Local\Temp\mex_IMGr2e\templib.x" /MAP:"multiwall_model.mexw64.map"
LINKDEBUGFLAGS = /debug /PDB:"multiwall_model.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"multiwall_model.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------


--> cl /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\Users\wildcat\AppData\Local\Temp\mex_IMGr2e\multiwall_model.obj -I"C:\Program Files\MATLAB\R2012a\extern\include" -I"C:\Program Files\MATLAB\R2012a\simulink\include" /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 multiwall_model.c

multiwall_model.c
multiwall_model.c(179) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(186) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(193) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(289) : fatal error C1004: unexpected end-of-file found

C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'multiwall_model.c' failed.

Error using mex (line 206)
Unable to complete successfully.

06 Jul 2012 Sebastien PARIS

sounds strange ... line 290 doesn't exist for me. Are u sure that u didn't modified the source somewhere ? (with another editor)
Try to copy/paste all the source in a new one and compile it

06 Jul 2012 Michael

-> Default options filename found in C:\Users\wildcat\AppData\Roaming\MathWorks\MATLAB\R2012a
----------------------------------------------------------------
-> Options file = C:\Users\wildcat\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2012a
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
OPTIMFLAGS = /O2 /Oy- /DNDEBUG
DEBUGFLAGS = /Z7
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"C:\Users\wildcat\AppData\Local\Temp\mex_WVxqiL\templib.x" /MAP:"multiwall_model.mexw64.map"
LINKDEBUGFLAGS = /debug /PDB:"multiwall_model.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"multiwall_model.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------


--> cl /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\Users\wildcat\AppData\Local\Temp\mex_WVxqiL\multiwall_model.obj -I"C:\Program Files\MATLAB\R2012a\extern\include" -I"C:\Program Files\MATLAB\R2012a\simulink\include" /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 multiwall_model.c

multiwall_model.c
multiwall_model.c(179) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(186) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(193) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
multiwall_model.c(290) : fatal error C1004: unexpected end-of-file found

C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'multiwall_model.c' failed.

Error using mex (line 206)
Unable to complete successfully.

06 Jul 2012 Sebastien PARIS

can u compile (without OpenMP support) by :

mex -v multiwall_model.c

and copy/paste compilation log ?

06 Jul 2012 Michael

yes win7 64, and visual studio 10.0 (not sure if that is 2010)

06 Jul 2012 Sebastien PARIS

win7 64 ?, visual studio 2010 ? (SDK is extra API)...

06 Jul 2012 Michael

Yes, I have run the mex setup. I am using windows 7, matlab version R2012a, and compiler Microsoft SDK 7.1

06 Jul 2012 Sebastien PARIS

Michael,

Did you run at least once : "mex -setup"
What is your system ? OS, Matlab version, Compiler version ?

05 Jul 2012 Michael

Yes, I receive an error running that as well. The error says it cannot complete the mex successfully.

04 Jul 2012 Sebastien PARIS

Did you run mexme_multiwall_model to compile mex-files ?

03 Jul 2012 Michael

Hello Mr. Paris,

This has helped me greatly on a project I am working on, however, when I run the test model and after I right click I receive an error saying: "Undefined function 'multiwall_model' for input arguments of type
'double'.

Error in test_multiwall_model (line 34)
rs_amp = multiwall_model(TXpoint ,RXpoint , walls ,
material , L0 , n);'

Thanks and any help would be greatly appreciated.

-Mike

28 Oct 2011 Sebastien PARIS

Gowrishankar,

Please change your C compiler. You can use the free MSVC express from Microsoft. Please refer which MSCV express you can use according to you current Matlab version

27 Oct 2011 Gowrishankar S

Dear All,

I'm getting the following error while compiling the multiwall_model.c file. Can anyone give me some pointer on how to rectify this error?

Thanks in advance

mex multiwall_model.c
lcc preprocessor warning: multiwall_model.c:241 Unknown preprocessor control endifs
lcc preprocessor error: multiwall_model.c:289 Unterminated #if/#ifdef/#ifndef
Warning multiwall_model.c: 236 local `double u' is not referenced
Warning multiwall_model.c: 236 local `double t' is not referenced
Warning multiwall_model.c: 236 local `double dy' is not referenced
Warning multiwall_model.c: 236 local `double dx' is not referenced
Warning multiwall_model.c: 236 local `double by' is not referenced
Warning multiwall_model.c: 236 local `double bx' is not referenced
Warning multiwall_model.c: 236 local `double cy' is not referenced
Warning multiwall_model.c: 236 local `double cx' is not referenced
Warning multiwall_model.c: 236 local `double denom' is not referenced
Warning multiwall_model.c: 235 local `double L' is not referenced
Warning multiwall_model.c: 235 local `double Lfsl' is not referenced
Warning multiwall_model.c: 235 local `double disttr' is not referenced
Warning multiwall_model.c: 234 local `double y4' is not referenced
Warning multiwall_model.c: 234 local `double y3' is not referenced
Warning multiwall_model.c: 234 local `double y2' is not referenced
Warning multiwall_model.c: 234 local `double _y1' is not referenced
Warning multiwall_model.c: 234 local `double x4' is not referenced
Warning multiwall_model.c: 234 local `double x3' is not referenced
Warning multiwall_model.c: 234 local `double x2' is not referenced
Warning multiwall_model.c: 234 local `double x1' is not referenced
Warning multiwall_model.c: 233 local `int iNt' is not referenced
Warning multiwall_model.c: 233 local `int kd' is not referenced
Warning multiwall_model.c: 233 local `int jd' is not referenced
Warning multiwall_model.c: 233 local `int id' is not referenced
Warning multiwall_model.c: 232 local `int k' is not referenced
Warning multiwall_model.c: 232 local `int j' is not referenced
Warning multiwall_model.c: 232 local `int i' is not referenced
Error multiwall_model.c: 288 syntax error; found `end of input' expecting `}'
2 errors, 28 warnings

C:\PROGRA~1\MATLAB\R2007A\BIN\MEX.PL: Error: Compile of 'multiwall_model.c' failed.

13 Oct 2011 Sebastien PARIS

Thanks u. A small update with openMP support will be published soon.

13 Oct 2011 Faisol Riza

It's ok then. Btw thank you very much. Your work is so good.

13 Oct 2011 Sebastien PARIS

Faisol... Can't tell you, I can't remember this detail.

13 Oct 2011 Faisol Riza

Hello Mr. Sebastien,

I wonder how you set the parameter of L0=40.2 in the m file. Whereas in the reference you attach in C file, it say 47,4. It is very helpfull if you would explain it.

Thank you very much

07 Oct 2011 Sebastien PARIS

midavisdj,

No you can't process like directly. You must to some image processing to extract walls from your floorplan ....

05 Oct 2011 midavisdj

Hi Sebastien

I need to know if I can use an image (.jpg) and use it as background.

19 Apr 2011 Sebastien PARIS

Jachym: you have to fill according to your floorplan variables :

1) walls (4 x nwall) where [xi,0 ; yi,0 ; xi,1 ; yi,1] are coordinates of the i'th wall, i = 1,...,nwall.

2) material (2 x nwall) where [typei ; ni] reprensents type of wall and associated attenuation index, i = 1,...,nwall.

This part is the most boring to do from a floorplan.

14 Apr 2011 Jachym

Hi Sebastien, thanks for your model. I would like to use it with my small floorplan (for my school work). Which file should I edit to define own walls place and walls materils?
I didn't find manual or something else about model.
Thanks
Jachym

24 Aug 2010 Tanyer Alan  
01 Jul 2010 Sebastien PARIS

For a more complete modelization, please have a look to :

http://www.mathworks.com/matlabcentral/fileexchange/21149-particle-filter-for-robot-localization-using-wifi-measurements

29 Jun 2010 kimo

Hello again,
sorry but I figured out that the answer was NO.
I have two more questions please.
- Is it possible to take these phenomena easily and efficacely?
- Is the choice of the material matrix dimension (2*N) going in this direction (rather than (1*N))?
Thanks for your response and this vgood file.
Regards,

28 Jun 2010 kimo

Hi,
Can you tell us please if the reflection, diffraction and refraction phenomena are taken into account?
Thanks for responding
Kimo

05 May 2010 Sebastien PARIS

There is a reference in the top of the C-fille...

Regards,

01 May 2010 michael

Sebastien,

can you please explain the mathematics behind the multi-wall model in your C file?
i know that it counts walls,
but how do you check that you pass them?

thank you

04 Apr 2010 Sebastien PARIS

Ho yeah, it's true .... Update with this minor bug, thx you.

03 Apr 2010 Ben Jones

To get it to work I had to change line 132 in multiwall_model.c from

#define MAX(a , b) ((a) >= (b) ? (a) : (b))

to

#define max(a , b) ((a) >= (b) ? (a) : (b))

21 Nov 2009 Mohd Sharim

Hello Sir,

Can you please explain me for the usage of the .mw* file in MATLAB. Thanks

10 Sep 2009 Mohd Sharim

Hello Mr. Sebastien Paris,

Thank you for your help regarding to my last question. Now I need your help to study path loss characteristic in 2D database. Here I got a 2D database. When I tried to load the database base using 'imread' command and then load the file in your multiwall model, MATLAB unable to load the file. So, if you have any idea regarding to this post, please help me Sir.

Thank You,

Sincerely Yours,

Sharim

01 Sep 2009 Sebastien PARIS

Please open the *.c file and find the quoted reference.

31 Aug 2009 Mohd Sharim

Hello Mr. Sebatien Paris,

I'm interested with the 2D Multiwall Model. Here Im just curious about the reference value and power factor decay that you used. May I know which propagation model that you referred for both of the values.

Thank You,

sincerely Yours,

Sharim

25 Jul 2009 Sebastien PARIS

Ok, the getpts function is from the image processing toolbox. There are plenty of similar functions in the FEX.

23 Jul 2009 Bing

Hello,
there is a problem,
??? Undefined function or variable 'getpts'.

Error in ==> test_multiwall_model at 27
[x , y] = getpts;

pls help,thank u

25 Mar 2009 Sebastien PARIS

I don't understand your question. You have just to run the demo file 'test_multiwall_model.m'. data_mw is matlab data file. You can load it with the command load.

22 Mar 2009 yon

hi
please how i make the (data_mw), the file appeare as winap medea player file.can you clear me that?

so thanks.

Updates
27 Nov 2009

-add mexme_multiwall_model, a better inputs description and some small speed-up

04 Apr 2010

A minor bug in a #define and add mexme_multiwall_model

13 Oct 2011

-Cleanup code
-Add openMP support (to be compile with -DOMP directive and link with MKL)

09 Jul 2012

-Fix a typo bug introduced in the last update (thanks to Mickael)

Contact us