I am trying to obtain the left inverse of a non-square matrix in python using either numpy or scipy.
How can I translate the following Matlab code to Python?
>> A = [0,1; 0,1; 1,0]
A =
0 1
0 1
1 0
>> y = [2;2;1]
y =
2
2
1
>> A\y
ans =
1.0000
2.0000
Is there a numpy or scipy eq...
Does anyone know how to minimize a function containing an integral in MATLAB? The function looks like this:
L = Int(t=0,t=T)[(AR-x)dt], A is a system parameter and R and x are related through:
dR/dt = axRY - bR, where a and b are constants.
dY/dt = -xRY
I read somewhere that I can use fminbnd and quad in combination but I am not a...
A friend asked me about creating a small web interface that accepts some inputs, sends them to MATLAB for number crunching and outputs the results. I'm a Python/Django developer by trade, so I can handle the web interface, but I am clueless when it comes to MATLAB. Specifically:
I'd really like to avoid hosting this on a Windows server...
I have the following function:
function ypdiff = ypdiff(t,y)
a = 0.01;
b = 0.1;
ypdiff(1) = -a*y(1)*y(2);
ypdiff(2) = b*y(1)*y(2)-b*y(2);
ypdiff(3) = b*y(2);
ypdiff = [ypdiff(1) ypdiff(2) ypdiff(3)]';
If I want to solve this, I would call the ode45 function as follows:
[t y] = ode45(@ypdiff, [to tf], yo);
Bu...
I have a 3d matrix (n-by-m-by-t) in MATLAB representing n-by-m measurements in a grid over a period of time. I would like to have a 2d matrix, where the spatial information is gone and only n*m measurements over time t are left (ie: n*m-by-t)
How can I do this?
...
Does anyone know how I can compare the elements in an array with the adjacent elements?
For example, if I have an array:
0 0 0 1 1 1 1 0
0 1 1 1 1 1 1 0
0 1 0 1 1 1 1 0
0 1 1 1 1 1 0 0
0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1
Is there a way to cycle through each element and perform a logical test of whether the elements around it are equal ...
I'd like to establish a server(Java)/client (Matlab) communication using socket. They can send messages to each other. An example shows how to do this in Java server and Java client, http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html.
When I try to rewrite the client part in Matlab, I only can get the first me...
OK, I am still getting the hang of MATLAB. I have two files in different format.
One Excel file. data1.xls, size= 86400 X 62.
It looks like:
Date/Time par1 par2 par3 par4 par5 par6 par6 par7 par8 par9
08/02/09 00:06:45 0 3 27 9.9 -133.2 0 0 0 1 0
Another file, data2.csv, size = 144 X 27. (If nothing is missing.)
It looks like:
date...
I wrote some function, that makes use of persistent variables, for example:
function y = integrator(x, t)
persistent yr; %result
...
and then, if I call it only once in a cycle, everything works fine:
x = integrator(x_dot, t);
but if I want to call it twice with different arguments, it will give wrong results:
x = integrator(x_dot...
I'm currently considering R, matlab, or python, but I'm open to other options. Could you help me pick the best language for my needs? Here are the criteria I have in mind (not in order):
Simple to learn. I don't really have a lot of free time, so I'm looking for something that isn't extremely complicated and/or difficult to pick up. I ...
Possible Duplicates:
free matlab environment
Whats the best MATLAB equivalent? (open source or otherwise free)
Please suggest any open source/free software equivalent to Matlab for windows with same syntax which is best and widely used
...
I have a triangle in (u,v) coordinates in an image. I would like to draw this triangle at 3D coordinates (X,Y,Z) texture-mapped with the triangle in the image.
Here, u,v,X,Y,Z are all vectors with three elements representing the three corners of the triangle.
I have a very ugly, slow and unsatisfactory solution in which I (1) extract a...
Following Hartley/Zisserman's Multiview Geometery, Algorithm 12: The optimal triangulation method (p318), I got the corresponding image points xhat1 and xhat2 (step 10). In step 11, one needs to compute the 3D point Xhat. One such method is Direct Linear Transform (DLT), mentioned in 12.2 (p312) and 4.1 (p88).
The homogenous method (DL...
Hi,
I maintain a program which can be automated via COM. Generally customers use VBS to do their scripting, but we have a couple of customers who use Matlab's ActiveX support and are having trouble calling COM object methods with a NULL parameter.
They've asked how they do this in Matlab - and I've been scouring Mathworks' COM/ActiveX...
I want to read files from a directory in matlab. Then I need to check whether it is file or directory and then do processing. Can someone provide me a code snippet for that? or please suggest a link to do that?
...
I'm creating some plots in matlab and then saving it as EPS images.
What is important, I create sets of 4 images, take the 'YLim' value from the first image, and then set it to the other 3 images. I do it to force the same Y-axis limits for each image in the set.
So for the first image, I create some figure, plot something on it, and...
Hello everyone. i have a problem to using a dll fortran in matlab.
i couldn't use a dll ,that is built by fortran, in matlab. i use "loadlibrary" instruction in matlab but the error is related to header files.
what is header files??
please give me more information to load a dll fortran in matlab and call it.
...
Ok I seem to have got the most of the problem solved, I just need an expert eye to pick my error as I am stuck.
I have a file of length [125 X 27] and I want to convert it to a file of length [144 x 27]. Now, I want to replace the missing files (time stamps) rows of zeros. (ideally its a 10 min daily average thus should have file leng...
Hi,
This is a follow up question from a previous SO question. Now I have a bit which I have spread it into 8 bits. I have use Amro's solution to spread the bit to 8 bits. Now I want an inverse way to convert the 8bits back to the single bit.
I have only managed to implement the inverse using for loop which take alot of time in the appl...
Hello,
I have this doubt.. I need to append the array of string in Matlab. Please suggest me how to do it..
I would like to append the string column wise on each iteration..
Here is a small code snippet which i am handling
<CODE>:
for_loop
filename = 'string';
name=[name; filename]
end
Thanks
Kiran
...