Answered
Removing outliers in data
Although picture may be worth a thousand words, having your data to work with is worth a thousand pictures. I would begin ...

9 years ago | 0

| accepted

Answered
How to find combination of random number of vectors?
Save the results in a cell array: C = {[1 2 3] [2 3 4 5] [9 8 2]}; for i = 1:2 output{i} = combvec(C{i...

9 years ago | 0

| accepted

Answered
How can i find a fit for a data set with an user defined function?
One approach (using only MATLAB, no Toolboxes): x = [ ... ]; y = [ ... ]; ro_fcn = @(b,y) y/210000 + b(1).*y.^b(...

9 years ago | 1

Answered
Definite integral using cumtrapz()
I’m not certain what result you want. Here are two possibilities, the first using *|trapz|*, the second using *|cumtrapz|*:...

9 years ago | 0

| accepted

Answered
Conditional running summation in an array
If I understand correctly what you want to do, this works: T = [2,0,0,0,0,0,1.66;2,32.96,0,0,0,0,0;1,75.61,0,0,0,0,0;1,0,...

9 years ago | 1

| accepted

Answered
Extracting elements from a matrix according to row number
I would use the *|sub2ind|* function, to convert the subscripts to linear indices: idx = sub2ind(size(A), X', (1:4)'); ...

9 years ago | 0

| accepted

Answered
How can I find parameters using ode45 function?
I would calculate it from the solved values for *|‘x’|*: lamda = 10; surface = x(:,2) + lamda*(x(:,1)-5); Unless you...

9 years ago | 0

Answered
Generating stretched cartesian grid for lid driven cavity numerical simulation
Here is one option: t = linspace(-pi, pi, 50); v = cos(t); figure(1) plot(t, v); [X,Y] = meshgrid(v); ...

9 years ago | 1

Answered
Vector of length 0 with ode45
I could not reproduce the error you reported once I tweaked your code a bit to get it to run. This works: functio...

9 years ago | 0

| accepted

Answered
function type double-> function_handle
See the documentation on <http://www.mathworks.com/help/matlab/function-basics.html *Function Basics*> (link), and <https://www....

9 years ago | 0

| accepted

Answered
Problem defining anonymous functions with multiple inputs
From the *|fmincon|* documentation for the <https://www.mathworks.com/help/optim/ug/fmincon.html?s_tid=doc_ta#input_argument_d11...

9 years ago | 1

Answered
division of float numbers
See the documentation for the <https://www.mathworks.com/help/matlab/ref/format.html *|format|*> (link) function. Specifica...

9 years ago | 1

Answered
matrix dimension must agree
Adding the *|‘0’|* elements in *|‘a’|* and *|‘b’|* are causing the problem, as well as _horizontally_ concatenating the *|sin|* ...

9 years ago | 1

| accepted

Answered
I want to make a plot of the Estimate value, but the plot only shows one point, how do I store the values of the variable Estimate?
Try this for the loop calculation: Estimate(1) = 0; v = 1:N; for k = 2:numel(v) Estimate(k) = Estimate(k-1) +...

9 years ago | 0

| accepted

Answered
How does MATLAB do fft and ifft in matrices
The *|fft|* function computes the discrete Fourier transform on the _columns_ (dimension 1) of a matrix, unless you tell it to c...

9 years ago | 0

| accepted

Answered
Fixing axes for a rotating globe under an orbit
I can’t run you code because I don’t have the Mapping Toolbox. I offer this code snippet as inspiration: [X,Y,Z] = sp...

9 years ago | 0

| accepted

Answered
Hi, i'm trying to build a function but i'm getting an error, Can anyone help me out
You need to call your function with some value for *|‘r’|*, either from the Command Window or a calling script (or function). Y...

9 years ago | 0

| accepted

Answered
Undefined function 'movmean' for input arguments of type 'double'
The *|movmean|* function was introduced in *|R2016a|*. You can use a <https://www.mathworks.com/help/matlab/ref/filter.html...

9 years ago | 2

Answered
Comparing 2 matrix with not the same dimension
Use the *|ismember|* function and the logical negation *|‘~’|* operator: A=[2 1 4 3 5 6]; B=[5 4 3 1]; A2 = ~ism...

9 years ago | 0

| accepted

Answered
what will be the code if i want to display the contents of the file in Matlab editor.
One option is the <https://www.mathworks.com/help/matlab/ref/edit.html *|edit|*> (link) command. Others (such as *|text|* and *...

9 years ago | 0

Answered
Change the beginning of the coordinate system
One possibility is to use the Axis Properties <https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.axes-properties.ht...

9 years ago | 0

Answered
How to set the step size signal using step command?
The *|step|* function only delivers unit amplitudes. One option would be to cascade an ‘amplifier’ with your system. ...

9 years ago | 0

| accepted

Answered
How to use the result of an equation as a variable of the same equation?
I am not certain what you want. This seems like simple algebra: p0 = (5*V*p)/(5*V - 7*a*dvda); If you want it as a...

9 years ago | 0

| accepted

Answered
How to save solutions in .mat file?
You have to have *|'Filename.mat'|* in your MATLAB search path. See the documentation on <https://www.mathworks.com/help/ma...

9 years ago | 0

Answered
Help with using Complementary filter (Madgwick) for IMU orientation estimates
*_‘The best I have managed is a crude resampling (using the resample function) and artificially allocating resampled data points...

9 years ago | 0

Answered
Lagrangepoly function shows me an error, why?
You first need to download it from the File Exchange at <https://www.mathworks.com/matlabcentral/fileexchange/13151-lagrange-int...

9 years ago | 1

| accepted

Answered
Textscan doesn't work in reading csv files
If you have *|R2013b|* or later, use the <https://www.mathworks.com/help/matlab/ref/readtable.html *|readtable|*> (link) functio...

9 years ago | 1

| accepted

Answered
'/' used for creating an axis, DFT
This assignment: freq = [-pi+pi/L:2*pi/L:pi-pi/L]; is apparently for a two-sided Fourier transform, where *|‘L’|* is th...

9 years ago | 1

| accepted

Answered
Remove zeros from cell
This replaces the zeros with empty square brackets: mydata = { 0.223811939491137 0.751267059305653 0.255095115459269 ...

9 years ago | 0

| accepted

Answered
Trouble with fprinft and transpose.
Since all your variables are _row_ vectors, try this: fprintf ('\t%5.1f %7.4f %7.4f %10.4f \n', [A; x; y; z]) It should...

9 years ago | 1

Load more