I'd like to generate some code using MATLAB Embedded Coder that runs an fft2 operation on a uint8 datatype. The end application is going to operate on images up to 4096 by 4096, so I'd like to not have to use the double (~134MB of double data vs. ~16MB) input required to get emlc to compile my code right now.
Here's a sample of what I'm...
Given 3 vector-pair, X, Y and Z, how to generate the contour? I understand that we need to make use of the contour plot. But the thing is that we need to pass in a 2x2 matrix for this argument, which presumably, is a matrix of Z corresponding to each X,Y pair. But this would mean that I have to go extra miles to create such a matrix by u...
I am using
net = newfit(in,out,lag(j),{'tansig','tansig'});
to generate a new neural network. The default value of the number of validation checks is 6.
I am training a lot of networks and this is taking a lot of time. I guess it doesn't matter if my results are a bit less accurate if they can be made considerably faster.
How can ...
I am writing a Matlab extension using the C++ ublas library, and I would like to be able to initialize my ublas vectors from the C arrays passed by the Matlab interpeter.
How can I initialize the ublas vector from a C array without (for the sake of efficiency) explicitly copying the data. I am looking for something along the following li...
I have noticed that MATLAB provides the BLAS and LAPACK headers among others:
$ ls ${MATLAB_DIR}/extern/include/
blas.h engine.h lapack.h mat.h mclmcr.h mex.h mwutil.h
blascompat32.h fintrf.h libmatlbm.mlib matrix.h mclmcrrt.h mwdebug.h tmwtypes.h
emlrt.h ...
Is there a keyword in Matlab that is roughly equivalent to None in python?
I am trying to use it to mark an optional argument to a function. I am translating the following Python code
def f(x,y=None):
if y == None:
return g(x)
else:
return h(x,y)
into Matlab
function rtrn = f(x,y)
if y == []:
rtrn = g(x);...
I need to test some basic image processing techniques in Matlab. I need to test and compare especially two types of filters: mean filter and median filter.
To smooth image using median filtering, there is a great funtion medfilt2 from image processing toolbox. Is there any similar function for mean filter? Or how to use the filter2 func...
I often hear people complain how expensive MATLAB licenses are. Then I wonder why they don't just use R. But is it right? Can you use R to replace MATLAB?
...
How can I make a simple low-pass FIR filter using Matlab (without using the built-in function) ?
Problem example:
Implement a FIR LPF with cut-off frequency 250Hz
it may also be necessary that, sampling freq is given...
Solution attempt or what I already know:
x = [...] -> input signal
A = 1; -> Since this is FIR
B = [?????]
y = fi...
I am translating some python code to Matlab, and want to figure out what the best way to translate the python tuple unpacking to Matlab is.
For the purposes of this example, a Body is a class whose constructor takes as input two functionals.
I have the following python code:
X1 = lambda t: cos(t)
Y1 = lambda t: sin(t)
X2 = lambda t: ...
I am playing with some neural network simulations. I'd like to get two neural networks sharing the input and output nodes (with other nodes being distinct and part of two different routes) to compete. Are there any examples/standard algorithms I should look at? Is this an appropriate question for this site?
Right now I'm using a thresho...
When playing a sound using e.g:
sound(x,fs);
I sometimes by accident play the wrong one. If x is of substantial length, I currently try to wait until the sound has completed. Any suggestions on how to "abort" the playback? I've already tried
sound(mute,fs); % Mute is a short vector containing all zeroes
But that didn't work. I'm us...
How do you take one plot and place it in the corner (or anywhere for that matter) of another plot in MATLAB?
I have logarithmic data that has a large white space in the upper right-hand side of the plot. In the white space I would like to overlay a smaller plot containing a zoomed in version of the log plot in that white space (sort ...
Suppose I have an AxBxC matrix X and a BxD matrix Y.
Is there a non-loop method by which I can multiply each of the C AxB matrices with Y?
...
I have q = [3 4 5]; and w = [5 6 7];. I want to compare every element of q with w (i.e. 3 compared with 5, 6, and 7). If it matches any element in w (like how 5 is in both q and w) then both q and w share 5 as a common key. How can I compute all the common keys for q and w?
...
I have the matrix:
a = [ 1 2 3 4;
2 4 5 6;
4 6 8 9]
and I want to compare every row with every other two rows one by one. If they share the same key then the result will tell they have a common key.
...
I had posted a similar question related to plotting data, and now I'd like to know how to handle missing data when outputting data to an Excel file using the XLSWRITE function.
I have two sets of data of different length (described in the question I link to above). I am trying to replace the smaller file with zeroes for the times when t...
Let's say I have a Surface(S1), and I have another surface (S2) that cuts through it. How to find the polyhedron formed by the intersection of the two, as shown?
In the above example, there should be two polyhedrons returned, one above S2, another below S1.
But S1 and S2 are defined by 3D coordinates. Let's say the coordinates for S1...
Hi
What I need to do is to create a "special" kind of median filter for image processing in Matlab - the "holey" median filter. This is a filter that excludes the element at the center of the area.
For standard median filter I use the medfilt2 function, but I can't pass the mask (kernel) for it as a matrix (it's not a linear transform...
I have a structure array containing fields as structure arrays of varying length. For example:
's' is a structure
'data' is a field in 's', and also a structure array itself
and
length(s(n).data) ~= length(s(m).data)
I want to preallocate an array that takes a time stamp from every field s.data.timestamp.
Is there a way to do this wi...