Skip to main content

Questions tagged [matlab]

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
77 views

What algorithm should I use to optimize a bike sharing redistribution system?

I want to optimize a bike-sharing redistribution system( find the best way for an agent to take bikes from a station that has more bikes than needed and relocate them to a station that needs more ...
Relu Morosan's user avatar
0 votes
1 answer
199 views

How to go from Simulink to embedded fixed-point DSP processor?

A library of audio algorithms is modeled, tested and verified in Simulink (graphical block diagramming tool). It needs to go from this existing Simulink models down to a multiple embedded platforms (...
Danijel's user avatar
  • 101
2 votes
1 answer
123 views

Separating Plotting and Computation Logic in Scientific Computing MVC App

I’m developing a Matlab GUI for a scientific computing application and need to plot fairly heavy intermediate results. Currently, the computation is represented as a function. The GUI accepts user ...
Dragonsheep's user avatar
5 votes
1 answer
501 views

Best practice for grouping related constants

I'm working on Finite Element code in MATLAB, and the number of constants (for instance user input defining the geometry, physics, numerical solution scheme) is substantial. Currently, I've been ...
Dominic Jarecki's user avatar
-4 votes
2 answers
204 views

How can I control my versioning (perhaps with GIT), such that when I update a function (such as add an argument) it won't break the rest of the code?

I'm just working on a set of MATLAB files right now that I'm using for my thesis. I want to be better organized and figure out the best way to keep track of changes. I have read that GIT is a good ...
teepee's user avatar
  • 95
0 votes
1 answer
310 views

Do all Get/SetAccess, Access, and Dependent property attribute combinations have valid use cases?

If You are Unfamiliar with OOP Matlab For those not familiar with matlab, matlab provides a variety of access attributes when creating member variables. All member variables are essentially C# ...
Krupip's user avatar
  • 1,300
0 votes
2 answers
359 views

Is there a name for being able to substitute a variable for the source code assigned to it?

Consider the following (python) code x = [1, 2, 3, 4] y = 2 + 3 z = x[0] + y Here, I can substitute the expressions for x and y verbatim in the expression for z, possibly by surrounding then in some ...
Eric's user avatar
  • 307
3 votes
0 answers
383 views

Avoiding global variables by using persistent variables in MATLAB

Disclaimer: Although I mention my use in matlab I think this is is more of a programming pattern question so I put it here. If I am incorrect I will be happy to go over to stackoverflow. I have a ...
rick_2047's user avatar
2 votes
0 answers
884 views

Programming a good puzzle game (Puyo Puyo) AI

I'm trying to build a strong AI for a game called Puyo Puyo, in Matlab (I know... but it's the only language I know well). Basically it's like Tetris but you get falling pairs of 2 puyos (blobs) of ...
BrouH's user avatar
  • 29
3 votes
0 answers
772 views

Rotation logic for MNIST Handwritten Digit Dataset

I am currently applying some pre-processing to this dataset. Some of the digits are extremely rotated and I would like to know how others managed to get them 'upright'. I have implemented something ...
Norman Bentley's user avatar
-1 votes
2 answers
736 views

Translate MATLAB expressions containing "^" power operator to C++ syntax [closed]

Brief: I have several very large math expressions written in Matlab/Octave syntax. I want to evaluate them within a C++ function by copy and pasting them in, however the problem is they contain "^" ...
axplusbu's user avatar
3 votes
2 answers
468 views

User Inputs: Bounding Box, best practice?

I am creating a function in matlab that takes in two lat/long coordinates (opposite corners of a rectangle) and returns information about data in the region. How do I group my inputs? e.g. [lat1,...
tenwest's user avatar
  • 131
2 votes
3 answers
862 views

Can programs of different languages communicate information without file io? [duplicate]

Is it possible to write a C++ program that, say, passes an int array to a java program without writing it to a file? Motivation for question: I was wondering what matlab is and how it came to be an ...
Minh Tran's user avatar
1 vote
1 answer
269 views

Dealing with data containing integer overflow, rollover

I am writing a small matlab function to analyze data from a laser probe. The data to be analyzed is basically: x-data: Position. y-data: Laser (light) intensity. The sensor automatically changes the ...
Keine's user avatar
  • 131
0 votes
2 answers
632 views

How to change the same code stored in several places after I improve one of them?

I have some code written in Matlab. I use the code in different folders which contains different data. Because I want to change some parameters for each different data, I keep the code in the folder ...
MOON's user avatar
  • 101
7 votes
2 answers
691 views

Is there something peculiar to Matlab or Mathworks that supports so much "undocumented" code?

I've been drilling into a lot of Matlab recently trying to interface with an in house algorithm engineer's work to modularize it for use in a test bench outside his suite of applications. I've come ...
jxramos's user avatar
  • 369
3 votes
1 answer
14k views

Plotting electrical field lines on a 2d plane [closed]

How do you plot equipotential electrical field lines on a 2d plot in MATLAB. Would it be best to use either quiver or contourf? Some example points are: p1 = (1,1) with 1 coulomb charge. p2 = (2,2) ...
Firo Proncho's user avatar
3 votes
1 answer
251 views

Where does test fixture code fit in?

This is an unusual question since I don't believe it lends itself to typical software development practices but I hope you can prove me wrong. In MATLAB, my team have created several signal ...
Sam Delaney's user avatar
0 votes
1 answer
83 views

Should instance variables be bound to the instance right in the beginning of the method they are created in?

A common problem for me - and it's not really a problem, but somehow I again and again ask myself, what is the normal way to handle this - is that there is a method and within this method a couple of ...
embert's user avatar
  • 103
10 votes
4 answers
3k views

Why are scientific programming languages so weird? [closed]

It seems to me that programming languages meant for use in science and engineering are consistently weird compared to general-purpose languages. Some examples off the top of my head: In Matlab, each ...
haroba's user avatar
  • 225
2 votes
2 answers
2k views

How to reduce close points

input: C matrix 2xN (2D points) output: C matrix 2xM (2D points) with equal or less points. Lets say we have C matrix 2xN that contains several 2D points, and it looks something like that: What we ...
Matan Touti's user avatar
3 votes
2 answers
483 views

Is input validation necessary?

This is a very naive question about input validation in general. I'm a MATLAB user (1.5 years old) and I learned about input validation techniques such as "parse" and "validatestring". In fact, ...
Kouichi C. Nakamura's user avatar
1 vote
3 answers
1k views

algorithm to create all possible column vectors of size N containing only ones and zeroes [closed]

I am a mathematics student and am just starting to learn about programming. I am stuck on a particular program I am trying to write for fun. I want to find an algorithm to create all possible column ...
Slugger's user avatar
  • 131
1 vote
1 answer
1k views

Programming Discrete Wavelet Transform

I am trying to program Discrete Wavelet Transform in Matlab. I do understand that their are various libraries available, but my project requires that I must implement it from scratch. I am taking a ...
user1343318's user avatar
3 votes
1 answer
567 views

How do I transparently cache data in intermediate stages of processing?

I am working with MATLAB on a model reduction algorithm. It is basically a data processing pipeline. ckt = generate_ckt(ckt_properties); freq = generate_fpoints(fconfig); result = freq_dom_sim(ckt,...
Milind R's user avatar
  • 155
5 votes
1 answer
3k views

In MATLAB, how can 'preallocating' cell arrays improve performance?

I was reading this article on MathWorks about improving MATLAB performance and you will notice that one of the first suggestions is to preallocate arrays, which makes sense. But it also says that ...
Alex McMurray's user avatar
1 vote
2 answers
239 views

Trying to sort the coefficients of the polynomial (z-a)(z-b)(z-c)...(z-n) into a vector

So I have a factored polynomial of the form (z-a)(z-b)(z-c)...(z-n) for n an even positive integer. Thus the coefficient of z^k for 0 <= k < n will be the sum of all distinct n-k element ...
Set's user avatar
  • 167
4 votes
5 answers
496 views

Lines of Code vs. Optimal Language [closed]

I was wondering whether it is possible to give any advice as the the maximum number of lines of code at which one should consider switching from say MATLAB to a more low level language? Is it even ...
user avatar
1 vote
2 answers
810 views

Data acquisition, storage and management

I have a device that can measure different values over time, one sample per second. After one measurement run I can export the data in form of a CSV-file. One row per second with timestamp and about ...
Simon's user avatar
  • 111
15 votes
3 answers
2k views

Implementing technical paper algorithms in C++ or MATLAB

I am an Electrical Engineering undergrad. I've reading many technical papers about Signal and Image processing algorithms (reconstruction, segmentation, filtering, etc). Most of the algorithms shown ...
Damian's user avatar
  • 259
10 votes
5 answers
15k views

Moving to Python (SciPy and NumPy) for Scientific Computing [duplicate]

Just read a presentation about using Python for Scientific Computing. I am currently using MATLAB (student license FTW, which will expire when I graduate soon). So I was wondering how matured SciPy ...
notthetup's user avatar
  • 211
8 votes
7 answers
5k views

How to explain OOP to a matlab programmer? [closed]

I have a lot of friends who come from electrical / physical / mechanical engineering background, and are curious about what is "OOP" all about. They all know Matlab quite well, so they do have basic ...
Oak's user avatar
  • 5,265
16 votes
7 answers
1k views

Is there a recommended way to communicate scientific/engineering programming to C developers?

I have a lot of MATLAB code that needs to get ported to C (execution speed is critical for this work) as part of a back-end process for a web application. When I attempt to outsource this code to a C ...
gkdsp's user avatar
  • 497
25 votes
6 answers
10k views

Surviving MATLAB and R as a Hardcore Programmer [closed]

I love programming in languages that seem geared towards hardcore programmers. (My favorites are Python and D.) MATLAB is geared towards engineers and R is geared towards statisticians, and it seems ...
dsimcha's user avatar
  • 17.2k