Hi there,
I have 2 800x1 arrays in Matlab which contain my amplitude vs. frequency data, one array contains the magnitude, the other contains the corresponding values for frequency. I want to find the frequency at which the amplitude has reduced to half of its maximum value.
What would be the best way to do this? I suppose my two main ...
Hi,
I have the a for loop which perform the following function:
Take a M by 8 matrix and
1) Spilt it into blocks of size 512 elements (meaning X by 8 of the matrix == 512, and the number of elements can be 128,256,512,1024,2048)
2) Reshape the block into 1 by 512 (Number of elements) matrix.
3) Take the last 1/4 of the matrix and put i...
He,
My question is about this matlab
output:
>>model3.Mu
ans =
0.7677 -1.1755 -0.8956
-0.0100 0.0883 0.0235
0.0001 -0.0010 -0.0003
-0.0000 0.0000 0.0000
How to display this data in a 4x3 matrix with more than 4 decimals?
...
I converted the names of 12000 different .TXT files into a sequence of numbers from 1 to 12000. Using Matlab, how can I create a list or a vector with the original file name beside the corresponding number?
...
I'm a TA for an Introduction to MATLAB course, and the class has not yet learned the use of arrays (or in MATLAB, vectors). There is an exam coming up and one of the questions on the study guide is as follows:
[Tough problem] A mode is the number in a sequence that appears the most number of times. A user is prompted to enter a sequen...
I define an enumerated type in MATLAB
classdef(Enumeration) Color < Simulink.IntEnumType
enumeration
RED(0),
GREEN(1),
BLUE(2),
end
end
I can assign it:
>> x = Color.RED
x =
RED
I can display it like this:
>> disp(x)
RED
or like this
>> x.display()
x =
RED
How can I get access to that name ("R...
I have a problem with solving a simple integration through MATLAB. I want to solve this symbolic and don't have any problems doing this through other programs.
Well I have this equation:
syms k x
fX(x) = k * e^(-3*x) for 2 <= x <= 6
which I want to integrate from the interval 2 to 6. Then I would solve the equation, so that fX(x) = 1...
I have some code
function runTubulin()
n = 10;
for j = 1:n
TubulinModel();
end
plot(TubulinModel(), n);
So my problem is that TubulinModel has a random number of outputs So I keep getting
??? Error using ==> TubulinModel Too
many output arguments.
Error in ==> runTubulin at 11
plot(TubulinModel(), n);
Is ...
I'm writing a simple MATLAB program to solve a project Euler problem.
The program creates a 900 x 900 matrix. Before creation of this matrix c by the program, I pre-allocate it in the following way:
c = zeros(900,900);
This yields an orange error message: "The value assigned to variable 'c' might be unused".
Later in the program th...
Hi there I hope you can help me. I've made an M-file that outputs data into my Matlab command window in the form below (I've deleted the extra spaces). My question is, is there an easy way to convert this output into an array, without having to type all the data into the array editor as I'm currently doing? (Or even run it straight from ...
What's the best way to capitalize / capitalise the first letter of every word in a string in Matlab?
i.e.
the rain in spain falls mainly on the plane
to
The Rain In Spain Falls Mainly On The Plane
...
I have a bunch of times-series each described by two components, a timestamp vector (in seconds), and a vector of values measured. The time vector is non-uniform (i.e. sampled at non-regular intervals)
I am trying to compute the mean/SD of each 1-minutes interval of values (take X minute interval, compute its mean, take the next interva...
Hello,
I 'am triyng to build a link between my simulink model or just a m file and my c++ applicaton but i 'am having an issue. I don't really understand how matlab receive the data. and for simulink in which form should i send the data to the block ? I would like to send coordinates like xyz to matlab and with matlab scatter3 the stre...
How do you organize your Matlab code? I've come into ownership of several thousand lines of Matlab code, some as >900 line functions and a few directories full of function_name.m files. It's hard to figure out what everything is doing (or relating to) or figure out the dependencies. I'd like to reorganize things as I figure out what d...
I'm trying to convert the following code to Python from MATLAB for an EEG Project (partly because Python's slightly cheaper!)
Hopefully someone can point me in the right direction: I've started to alter it but got bogged down: Particularly trying to find equivalent functions.
Tried scipy.org (NumPy_for_Matlab_Users etc.) but I'm not s...
In the recent question "How to organize MATLAB code?" Andrew Janke mentioned in his answer using classes to organize MATLAB functions into packages:
... consider rewriting some of the code as objects, using stateless utility
classes with class methods and private functions as ways of packaging related
functions together and provi...
Hello there,
I'm writing a MATLAB program that will generate a matrix with 1 million rows and an unknown amount of columns (at max 1 million).
I tried pre-allocating this matrix:
a=zeros(1000000,1000000)
but I received the error that the "Maximum variable size allowed by the program is exceeded."
I have a feeling that not pre-alloc...
Hello!
I've writtend a GUI function in MATLAB R2009b which makes use of the IMRECT function. I need to make sure this GUI also works in MATLAB R2007b: since this release the IMRECT function has undergone extensive changes. I have two question:
1 - in the new (R2009b) IMRECT, a method GETCOLOR is defined which allows to get the color whi...
Here's an example of what I'm looking for:
>> foo = [88, 12];
>> [x, y] = foo;
I'd expect something like this afterwards:
>> x
x =
88
>> y
y =
12
But instead I get errors like:
??? Too many output arguments.
I thought deal() might do it, but it seems to only work on cells.
>> [x, y] = deal(foo{:});
??? Cell content...
In C, I might do something like this:
#define MAGIC_NUMBER (88)
int foo(int a, int b, int c) {
return a + b + c + MAGIC_NUMBER;
}
double bar(double x, double n) {
return x + n + MAGIC_NUMBER;
}
/*
* ...and so on with many kind-of-long functions using
* MAGIC_NUMBER instead of writing a literal 88 like so:
*/
double bar(double...