Answered
New to mablab and need some basic help!
You might find the histogram function useful.

7 years ago | 1

| accepted

Answered
How can I calculate the area between these two lines?
First, interpolate them to the same ‘x’ vector creating the ‘x’ vector with linspace and using interp1 for the interpolations, t...

7 years ago | 1

| accepted

Answered
Highlight line from 3D plot
Please see my Answer to your duplicated Question: Highligh a curve from a 3D plot.

7 years ago | 0

Answered
Array indicates must be positive integers or logical values
Taking a wild guess, you likely have a variable named plot or sum (or something similar) that is overshadowing a MATLAB function...

7 years ago | 0

Answered
how to handle unknown size of arrey
Use the size function to get the dimensions. There are other functions in and at the end of the size documentation that can pro...

7 years ago | 0

Answered
number coding the plot beside color coding
It is likely not possible to do exactly that, however you can come close. Try this: x = [1 10 14 17]; y = randi([-40 -11],...

7 years ago | 0

| accepted

Answered
I get the warning 'Function behaves unexpectedly on array inputs.' when using fplot()
With a scalar ‘t’, there are no problems provided that ‘z’ sets 'ArrayValued' to true in the integral call, and ‘u’ is vectorise...

7 years ago | 0

| accepted

Answered
non-linear 2nd ODE
Analytically, it likely does not have a solution since it is nonlinear and most nonlinear differential equations do not have ana...

7 years ago | 0

Answered
How to create a for loop?
Try this: D = load('PP1_TOJ.mat'); Data = D.Data; V = [-350:100:150 -50:50:50 150:100:350]; for k = 1:numel(V) respons...

7 years ago | 2

| accepted

Answered
Creating new matrix from odd and even elements of an existing matrix.
I am not certain what result you want. Try this: A = randi(9, 5, 6) OddRows = 1:2:size(A,1); EvnCols = 2:2:size(A,2); B ...

7 years ago | 0

| accepted

Answered
filtering problem, need help
Request two outputs from the bandpass and bandstop functions. The second output is the digital filter object. Displaying the d...

7 years ago | 1

| accepted

Answered
Problem attaching area text to segments and finding correct x crossing points
‘... so there is "bleeding" of patch across the XC points ...’ Use linspace and interp1 to create values with a greater preci...

7 years ago | 0

Answered
How to merge rows in an array
Try this: A = randi(99, 7, 4) Amerged = str2num(sprintf([repmat('%d',1,size(A,2)) '\n'],A.')) producing (in this run): A =...

7 years ago | 1

| accepted

Answered
For loop for inputting some discontinous numbers
The code you posted is a good start, however it will not work. This version of it will: c = 2.5; m = [1, 1.2, 10]; ...

7 years ago | 0

| accepted

Answered
Range selection in matlab plots
Change the lower ylim limit to zero: x = 0:19; y = randi([5 9], 1, 20); figure plot(x, y, 'p') ylim([0 max(ylim)]) ...

7 years ago | 1

Answered
how to insert a function into anonymous function
Call ‘f’ with the appropriate arguments: b = @(x,y,z)(0.6*x+y.^3-z+3*f(x,y,z)) Note that ‘a’ is the output, ‘f’ is the functi...

7 years ago | 0

| accepted

Answered
how to fix the error"Conversion to double from function_handle is not possible." for the code given below
I have no idea what youir code is doing. However, to calcuate with a function, it is necessary to evaluate it and then calculat...

7 years ago | 0

| accepted

Answered
How can I find data from an imported array that matches a user request?
The strcmp (or related strcmpi) function will return a logical value or array that you can use to index into the matching numeri...

7 years ago | 0

| accepted

Answered
Fitting a damping function to a sinusoidal response
See: Damped harmonic motion curve fit

7 years ago | 0

Answered
Getting data from inside ode15s solver
Do not use global variables! Write one version of your ODE function that ode45 (or whatever solver you are using) then solves...

7 years ago | 1

| accepted

Answered
Interpolating on a semilog scale
The interp1 function needs to know about the log transformation. Then, it will give you the correct result. Try this: A = ...

7 years ago | 0

| accepted

Answered
Find data between min and max
An accumarray call can do that relatively easily: D = load('test.mat'); task = D.task; time_s = D.time_s; TFmin = islocal...

7 years ago | 1

| accepted

Answered
Computing the infinite sum
It is likely best to initially leave out the numbers, then substitute them in later. Try this: syms rho s x y sum1(s) = v...

7 years ago | 0

Answered
Local Slope and Maxima of a Curve
This should get you started: D = load('GRF.mat'); GRF = D.GroundReactionForce; % Column Ve...

7 years ago | 1

Answered
Highligh a curve from a 3D plot
Try something like this: v = -1:0.1:1.2; % Create Data [X,Y] = ndgrid(v);...

7 years ago | 0

| accepted

Answered
Error bar for EEG data- standard deviation or standard error mean
If you are plotting the means, and you want to express the possible range each mean value could take at each point, then the sta...

7 years ago | 0

Answered
MATLAB not giving simplified answers
digits = 5; S = vpasolve(eqns,[x y z])

7 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #5 (and bug reports)
It would be nice to have advance warning of some type that the site is going down for maintenance, and how long it will be until...

7 years ago | 0

Answered
how to generate a scatterplot matrix
One option: D = readtable('diabetes.csv'); VN = D.Properties.VariableNames; Dmtx = table2array(D); figure semilogy((1:si...

7 years ago | 0

| accepted

Answered
some constant to the power vector
Try this: c=-6; n=-20:.5:20; Out = c.^n; producing (as a column vector): Out = 2.7351e-16 + 0i ...

7 years ago | 0

| accepted

Load more