MATLAB is a high-level language and interactive programming environment developed by MathWorks. It is the foundation for a number of other tools, including Simulink and various toolboxes that extend the core capabilities.
-1
votes
0answers
27 views
Maximum Recursion Occurs in Nested Matrix, Keller Box example [closed]
This is the full program and my proposed algorithm, i have fixed the syntax but i cant seem to let the program run, i seem some help to understand, what and where does this algorithm went wrong. it is ...
1
vote
0answers
39 views
How to make this more efficient
I have a fitness function where inputs x1 to x14 have values between 1:4. Is there a way to make to more efficient, any suggestions are useful please. I need to get the computation time down. A ...
0
votes
0answers
11 views
Using matlabpool: Is my embedding correct?
A general question: For using matlabpool, I write the line
matlabpool open local 12;
as the first line in my code and the line:
matlabpool close;
as the last. Is this correct?
1
vote
1answer
27 views
Matlab - Fastest way to parallel read many files line by line?
I have a few hundred files in a directory that I need to read in parallel. Namely, the files that have the same name, but different file extensions (.a and .b), but they're pretty much plain text ...
1
vote
2answers
66 views
Rational Approximation for e with Matlab
I've written a program that calculates the best rational approximation for e with a 1, 2, 3, 4, 5, and 6 digit denominator respectively (on Matlab). For a 5-digit denominator it takes about a minute. ...
2
votes
1answer
40 views
Matlab - build a combinatorial matrix from two vectors
I want to define a matrix of values with a very simple pattern. I've achieved it with the code below but it's ugly - very difficult to read (I find) and surely not as optimal, in terms of performance, ...
0
votes
0answers
16 views
How much mxRealloc can affect a C-Mex matlab code?
For these days I was working on C-mex code in order to improve speed in DBSCAN matlab code. In fact, at the moment I finished a DBSCAN on C-mex. But instead, it takes more time (14.64 seconds in ...
2
votes
2answers
38 views
Matlab: Can this triple loop be simplified or eliminated
Matlab profiler throws this horrible bottleneck which is called 700000 times:
for k =1:model.nlf,
for r =1:model.nlf,
KuyDinvKyu = zeros(model.k,model.k);
for q =1:model.nout,
...
14
votes
5answers
881 views
Naive C++ Matrix Multiplication 100 times slower than BLAS?
I am taking a look at large matrix multiplication and ran the following experiment to form a baseline test:
Randomly generate two 4096x4096 matrixes X, Y from std normal (0 mean, 1 stddev).
Z = X*Y
...
0
votes
1answer
298 views
2D convolution in matlab
function C = convolve_slow(A,B)
(file name is accordingly convolve_slow.m )
This routine performs convolution between an image A and a mask B.
Input: A - a grayscale image (values in ...
1
vote
1answer
205 views
Python / Numpy running 15x slower than MATLAB - am I using Numpy effeciently?
Here is some code I wrote in Python / Numpy that I pretty much directly translated from MATLAB code. When I run the code in MATLAB on my machine, it takes roughly 17 seconds. When I run the code in ...
5
votes
2answers
196 views
Drawing random smooth lines contained within a square
I'm trying to write a matlab function that creates random, smooth trajectories in a square of finite side length. Here is my current attempt at such a procedure:
function [] = drawroutes( ...
6
votes
1answer
91 views
how to improve this matlab code using homogeneus coordinates to rotate a matrix?
Currently, I have this code snippet, but it's a little bit slow:
% input image
input_matrix = imread('placa.bmp');
[rows cols] = size(input_matrix);
% rotation
degree = 30;
radians = (pi * degree) ...
2
votes
1answer
49 views
how to get B+ matrix (warshall algorithm) in matlab?
Pseudocode:
// B = nxn binary matrix
// Bm = resulting matrix
for (i=1; i<=n; i++)
{
for (j=1; j<=n; j++)
{
if (B[i,j] == 1)
{
for (k=1; k<=n; k++)
{
Bm[i,j] ...
5
votes
1answer
123 views
How to speed up this following code
I am doing my research about scheduling by using Matlab. I am a new Matlab user and I have a problem with time execution of my following code:
clc
clear all
A=8;
B=12;
C=10;
ProcessTime= [ 11 11 11 ...