# MATLAB-NS3
Co-simulate MATLAB with NS-3 network simulator, combining the powers of MATLAB and NS-3. Describe the scenario in MATLAB, run simulation from MATLAB, capture the results and visualize them in MATLAB.
Optionally use the MATLAB PHY and Channel models, instead of the statistical models of NS-3.
This co-simulation code currently:
* Supports modeling WLAN network and 802.11p based V2X scenarios.
* See the documentation for the list of supported classes.
* Works with NS3.29 version (see the GitHub branch for NS3.26 version support)
* Works on Linux. Can get it working on Windows, if the NS3 library port is available to Windows.
* For high-fidelity WLAN PHY and Channel modeling, MATLAB WLAN Toolbox is recommended. Included example usage for 802.11a.
* For proper visualization of the included examples, display should be of Full-HD (1920x1080) resolution.
## Example scenarios
Following example scenarios are included in this repository:
1. WLAN Infrastructure Example
2. Truck Platooning Example with V2X
3. Manhattan Grid Hazard Warning Example with V2X
See the included documentation in 'doc' folder, for more details.
## Folders in the repository
* doc - Documentation about the co-simulation and included examples
* mlCode/mlWrappers - MATLAB wrappers over NS3
* mlCode/mlWiFiPhyChannel - Sample MALTAB code using MATLAB WLAN Toolbox Phy and Channel modeling
* native/mexBindings - Mex bindings over native C++ classes of NS3
* native/mlPhy - Additional C++ classes for NS3 to invoke MATLAB WLAN Toolbox Phy and Channel models
* scenarios - Contains example scenarios written in MATLAB that utilize the MATLAB-NS3 co-simulation
* videos - Recorded videos, expaining the demo scenarios
## Setting up the co-simulation environment
Follow these steps to setup this co-simulation:
1. Download the source code (or download and extract the zip file). This gives out MATLAB-NS3 folder.
1. Download NS-3.29 from https://www.nsnam.org/release/ns-allinone-3.29.tar.bz2.
* Untar and place NS-3 source folder 'ns-allinone-3.29\' inside the MATLAB-NS3 folder
* Execute ‘NS3-build.sh’ to build all the necessary NS3 libraries using the following command
`$sh NS3-build.sh`
**Note:** *It is strongly recommended that you add LD_LIBRARY_PATH export to the shell startup script so that it is set automatically at startup.*
1. Add path to 'LD_LIBRARY_PATH' in the startup script
* If you use bash shell, add this line at the end of ~/.bashrc file:
`export LD_LIBRARY_PATH=<MATLAB-NS3 BASE FOLDER>/ns-allinone-3.29/ns-3.29/build/lib:$LD_LIBRARY_PATH`
* If you use csh / tcsh, add the following line at the end of ~/.cshrc file:
`setenv LD_LIBRARY_PATH<MATLAB-NS3 BASE FOLDER>/ns-allinone-3.29/ns-3.29/build/lib:$LD_LIBRARY_PATH`
**Note:** *You have to launch new terminal (shell) or restart the PC to get the environment with updated LD_LIBRARY_PATH.*
1. Launch MATLAB from the new terminal. Go to the folder MATLAB-NS3.
1. Run ‘buildMex.m’ to build Mex-binaries in the MATLAB Command Window.
`>>MATLAB-NS3/native/mexBindings/buildMex`
**Note:** *You may ignore warnings about GCC compiler version, thrown by MATLAB MEX. It works on Debian 8 (GCC version 4.9.x) and Debian 9 (GCC version 6.3.x). Should work with other GCC versions also.*
## Running the example scenarios
All examples are placed under ‘scenarios’ folder. Following steps are applicable to run any of the examples in this folder.
1. Go to any example folder, such as: MATLAB-NS3/scenarios/truckPlatooning/
2. Run ‘scenario.m’ script of any example. It might take around 2-3 minutes to complete. During this time the terminal will remain busy.
**Note:** *Running the simulation scenario will clear all the variables, close all the figures and unload all the functions in the current workspace.*
`>>scenario.m`
3. To visualize the results of the simulation, run the MATLAB script in the ‘visualizer’ folder of the same example.
`>>topologyVisualizer.m`
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。 Matlab(Matrix Laboratory)是一种专为数值计算和科学与工程应用而设计的高级编程语言和环境。在算法开发和实现方面,Matlab具有以下一些好处: 1. 丰富的数学和科学函数库:Matlab提供了广泛的数学、信号处理、图像处理、优化、统计等领域的函数库,这些函数库可以帮助开发者快速实现各种复杂的数值计算算法。这些函数库提供了许多常用的算法和工具,可以大大简化算法开发的过程。 2. 易于学习和使用:Matlab具有简单易用的语法和直观的编程环境,使得算法开发者可以更快速地实现和测试他们的算法。Matlab的语法与数学表达式和矩阵操作非常相似,这使得算法的表达更加简洁、清晰。 3. 快速原型开发:Matlab提供了一个交互式的开发环境,可以快速进行算法的原型开发和测试。开发者可以实时查看和修改变量、绘制图形、调试代码等,从而加快了算法的迭代和优化过程。这种快速原型开发的特性使得算法开发者可以更快地验证和修改他们的想法。 4. 可视化和绘图功能:Matlab具有强大的可视化和绘图功能,可以帮助开发者直观地展示和分析算法的结果。开发者可以使用Matlab绘制各种图形、曲线、图像,以及创建动画和交互式界面,从而更好地理解和传达算法的工作原理和效果。 5. 并行计算和加速:Matlab提供了并行计算和加速工具,如并行计算工具箱和GPU计算功能。这些工具可以帮助开发者利用多核处理器和图形处理器(GPU)来加速算法的计算过程,提高算法的性能和效率
资源推荐
资源详情
资源评论
收起资源包目录
MATLAB和NS3联合模拟.zip (178个子文件)
ml-wifi-phy.cc 11KB
ml-wifi-channel.cc 8KB
ml-wifi-helper.cc 5KB
mexMatlabWifiChannelHelper.cpp 14KB
mexNode.cpp 12KB
mexWaveHelper.cpp 11KB
mexIpv4Address.cpp 11KB
mexNodeContainer.cpp 11KB
mexNetDevice.cpp 11KB
mexConfig.cpp 10KB
mexYansWifiChannelHelper.cpp 9KB
mexWifiHelper.cpp 9KB
mexInetSocketAddress.cpp 8KB
mexMobilityHelper.cpp 8KB
mexApplicationContainer.cpp 7KB
mexSimulator.cpp 7KB
mexNqosWaveMacHelper.cpp 6KB
mexEventId.cpp 6KB
mexQosWaveMacHelper.cpp 6KB
mexUdpClientHelper.cpp 6KB
mexNetDeviceContainer.cpp 6KB
mexUdpEchoClientHelper.cpp 6KB
mexPacketSocketAddress.cpp 6KB
mexOnOffHelper.cpp 6KB
mexSsid.cpp 6KB
mexIpv4AddressHelper.cpp 6KB
mexInternetStackHelper.cpp 6KB
mexWifiMacHelper.cpp 6KB
mexIpv4InterfaceContainer.cpp 5KB
mexUdpServerHelper.cpp 5KB
mexWifi80211pHelper.cpp 5KB
mexSocketInterface.cpp 5KB
mexAddress.cpp 5KB
mexPacketSinkHelper.cpp 5KB
mexUdpEchoServerHelper.cpp 5KB
mexNs3State.cpp 4KB
mexTimeValue.cpp 4KB
mexIpv4GlobalRoutingHelper.cpp 4KB
mexConstantAccelerationMobilityModel.cpp 4KB
mexMatlabWifiPhyHelper.cpp 4KB
mexConstantVelocityMobilityModel.cpp 4KB
mexYansWifiPhyHelper.cpp 4KB
mexPacketSocketHelper.cpp 4KB
mexMobilityModel.cpp 3KB
mexDataRateValue.cpp 3KB
mexAddressValue.cpp 3KB
mexSsidValue.cpp 3KB
mexUintegerValue.cpp 3KB
mexStringValue.cpp 3KB
mexBooleanValue.cpp 3KB
mexDoubleValue.cpp 3KB
mexRngSeedManager.cpp 3KB
mexYansWavePhyHelper.cpp 3KB
mexConstantPositionMobilityModel.cpp 3KB
mexEmptyAttributeValue.cpp 2KB
mexMatlabWifiChannel.cpp 2KB
mexYansWifiChannel.cpp 2KB
mexNodeList.cpp 2KB
mexWifiPhyHelper.cpp 2KB
mexAttributeDumper.cpp 769B
deinitNs3Interface.cpp 407B
initNs3Interface.cpp 405B
ml-wifi-helper.h 8KB
ml-wifi-phy.h 5KB
ml-wifi-channel.h 5KB
mexNs3State.h 3KB
Example-WLANInfrastructure.html 273KB
GettingStarted.html 186KB
Example-ManhattanGridHazardWarning.html 88KB
Example-TruckPlatooning.html 72KB
ns3_supported_class_list.html 10KB
LICENSE 18KB
mobilityIntelligence.m 20KB
scenarioSetup.m 17KB
scenarioSetup.m 16KB
vehicularRoute.m 15KB
visualizerTraces.m 14KB
topologyVisualizer.m 13KB
topologyVisualizer.m 13KB
scenario.m 12KB
WSMPTraffic.m 12KB
scenario.m 11KB
mobilityIntelligence.m 10KB
manhattanTopology.m 10KB
scenario.m 10KB
visualizerTraces.m 10KB
WSMPTraffic.m 9KB
street.m 9KB
vehicularMobility.m 8KB
nodeListInfo.m 6KB
vehicularMobility.m 6KB
nodeListInfo.m 5KB
hazard.m 5KB
WSTCallback.m 5KB
WaveHelper.m 4KB
Ipv4Address.m 4KB
buildMex.m 3KB
MatlabWifiChannelHelper.m 3KB
Node.m 3KB
YansWifiChannelHelper.m 3KB
共 178 条
- 1
- 2
资源评论
若明天不见
- 粉丝: 1w+
- 资源: 272
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功