How do I find selfor in Octave? - neural-network

I need to implement unsupervised neural network using Octave. For that, I need to use "selforgmap" function. How do I find that function in octave or what are the packages include this function?
When I use "selforgmap", I got an error like this.
selforgmap
error: 'selforgmap' undefined near line 1 column 1
help selforgmap
error: help: 'selforgmap' not found

As of now there does not appear to be any implementation of selforgmap in octave or any of it's packages. The current neural net package, nnet, can be found at Octave Forge and the Function Reference link will show you everything currently included.
The link Andy commented with above to a current reworking if the nnet package also does not currently include selforgmap, but this could obviously change. The included function files can be seen inside the inst folder.
if MATLAB's selforgmap is not an option for you, you will either need to code your own implementation or switch bto another programming language. A quick search does reveal a Python implementation of selforgmap that may serve your purpose.

Related

Open the m file for System Objects in MATLAB

I am trying to use the Communications Toolbox in Matlab. In this toolbox there are a number of built in Systems Objects for example
1) comm.PSKModulator
I want to examine the .m file and see how these system objects are implemented. So I wrote down the command
open comm.PSMModulator
However, that doesnt help. Does anyone know why it doesn't work or maybe one cant access such code?
Update
When I write down which comm.PSKModulator I receive the following
/Applications/MATLAB_R2014a.app/toolbox/comm/comm/+comm/PSKModulator.p % comm.PSKModulator constructor
and where I write open comm.PSKModulator I get
Error using open (line 146)
File associated with
'/Applications/MATLAB_R2014a.app/toolbox/comm/comm/+comm/PSKModulator.p' not found.
Thanks
Some System objects may be implemented in C++ and does not have much to show in MATLAB code which might be the reason this is p-coded. You need to check the corresponding Simulink block documentation for description of the algorithm used. You can find documentation for M-PSK Modulator Baseband at http://www.mathworks.com/help/comm/ref/mpskmodulatorbaseband.html which has more description about the algorithm implemented.

running compiled matlab from matlab

I am trying to run compiled MATLAB code (by mcc) from inside MATLAB in a way that I can avoid using another license that is required by the compiled code. We need this because we run this same specific code part again and again and execution is stuck due to license waiting. We don't want to buy tons of this specific license just to mass run the same part. Is there any way to do this? tutorial?
Is it possible to compile a .m file to dll/so and wrap it like a mex and call it from MATLAB on the fly? How would I pass and retrieve complex arguments?
According to
http://www.mathworks.de/products/compiler/description3.html
creating shared libraries should well be possible.
Concerning passing and retrieving complex arguments:
If you plan to use mex, I'd assume you should be able to call the shared-library "main"-function with any arguments you'd like, using the mxArray type that you'll have to use anyway.
To run the MATLAB-compiled code in MATLAB, you want codegen, part of the MATLAB Coder. See this blog post on generating C code from MATLAB. The alternative, deploying code with mcc/mbuild and then reloading it into MATLAB with loadlibrary is rather contorted, and I wouldn't advice it.

Undefined function or method 'nanvar_base' in Matlab

Somehow my Matlab does not has the function nanvar_base, needed to use the function ttest2 to calculate the t and p value of two sample data. How do I install that function? Is it missing to anyone else?
I had this same issue, the ttest2 function calling a nanvar function from SPM rather than the MATLAB statistics folder. A simple fix is going into 'change paths' in MATLAB and moving the SPM paths to the bottom of the list.
The function ttest2 is part of the statistics toolbox.
However, when I try to edit it, it does not show any calls to nanvar_base.
Did you perhaps try to edit it yourself, and in the process made a mistake? If this is not the case, try edit ttest2 and see where it is located and show the line with the call to nanvar_base.
This function isn't part of MATLAB or any of its toolboxes/add-ons. It must be custom functions. There is a function call nanvar however, in the Statistics toolbox and also in the Financial toolbox. Is this maybe the one you're after? If so, do you actually have the Statistics Toolbox and/or the Financial Toolbox?
the problem is probably another toolbox (like SPM) getting in the way, with their own 'nanvar' function.
Move SPM to the bottom of the path definition list, or remove it completely.
In general moving SPM have a lot of conflicting functions, so always make sure their path is at the bottom.
I had the same issue when calling the function nanvar, and realised that there was a conflict with a function with the same name in the Fieldtrip toolbox (this Fieldtrip function calls nanvar_base). After removing the Fieldtrip/src folder from my paths, it worked fine.

how a function change in a loop with newtonsys command matlab

i want to change function variable at each step in a for loop in matlab.
i take these steps:
i created my mfile function
function [jfun,fun]=air(x,vt,ty,tz,p2,y0)
jfun=[(cos(tz)*cos(ty)*vt/9.81)*(1-exp(-9.81*x(2)/vt)),...
x(1)*cos(tz)*cos(ty)*exp(-9.81*x(1)/vt);
(-vt*sin(tz)*cos(ty)/9.81)*exp(-9.81*x(1)/vt),...
(x(1)*sin(tz)*cos(ty)*+vt)*exp(-9.81*x(1)/vt)];
fun=[(x(1)*cos(ty)*cos(tz)*vt/9.81)*(1-exp(-9.81*x(2)/vt))-p2;...
(vt/9.81)*(x(1)*sin(tz)*cos(ty)+vt)*(1-exp(-9.81*x(2)/vt))-vt*x(2)+y0];
end
and then i used newtonSys command:
ty=rad(-23)
tz=rad(15)
p2=1.8
vt=8.4925
y0=0.2
myfun=#(x)air(x,vt,ty,tz,p2,y0)
x=newtonSys(myfun,[15 5],0.000001,0.000001,500,1)
and matlab answer:
Error in ==> Untitled18 at 7
x=newtonSys(myfun,[15 5],0.000001,0.000001,500,1)
i guess that its because of wrong use of function handle and for my function i have to use another command or i have to use another method for solving 2nonlinear equation.
First, you haven't displayed the entire error. MATLAB should tell you what the actual error is, so unless you tell us that, we won't know what's wrong.
Secondly I don't see newtonSys in my system, or in the online MATLAB documentation. So most likely it is an external program, which most people here might not be familiar with. The closest I found from a quick Google search was this, which is an implementation of Newton's method for approximating the root of a non-linear system of n-equations. Are you using the same file? If so, if you look at the comments, it says that you need to pass the function as a string. So you'd have to pass myfun as 'myfun'.
If not, could you edit your question and add the contents of the function that you're using? Without these, it's near impossible to answer your question.

Failed to find library 'powerlib' matlab. Simulink program executing

When I tried to run a Simulink program under my R2009a Matlab, it showed an error message as follows: Failed to find library 'powerlib' referenced by 'dcmotor_openloop/Armature Current '. This library must be on your MATLAB path.
I'm wondering where I can find this powerlib.
As #Edric mentioned, powerlib is built into SimPowerSystems. The error you see can thus have two causes
(1) There is no installation of SimPowerSystems in your copy of Matlab. Type ver at the command prompt to check for what toolboxes you have installed. If SimPowerSystems doesn't show up in the list, you will have to get the toolbox, otherwise you won't be able to run the model.
(2) Your installation of SimPowerSystems is somehow corrupt. This has never happened to me in Matlab so far, but with modern technology, anything is possible. A fresh install should solve this.
powerlib is a Simulink library shipped as part of SimPowerSystems, see the product page here: http://www.mathworks.com/products/simpower/.
This should really be a comment on another answer, but I can't comment due to reputation.
From at least R2016b, perhaps earlier too, It's no longer called SimPowerSystems. It's now SimscapePowerSystems. You need that plus the bare Simscape package installed.