Answered
Get the inbetween values or the closest value
The find function is perfect for this: for i =1:length(b) closestIndex(i) = find((b(i) >= a(:,1)) & (b(i) < a(:,2))); en...

7 years ago | 0

| accepted

Answered
Integration of numerical data
For vectors of data, the best option would be the trapz (link) or the related cumtrapz functions, depending on the result you wa...

7 years ago | 0

Answered
How to visualize/plot min ave max values?
I can’t import images of your data, so I created my own as the ‘A’ matrix: A = [(1:12)' sort(rand(12,3),2)]; ...

7 years ago | 0

| accepted

Answered
anonymous function in ode45: column vector error
You are not calling ‘xdot’ correctly in your ode45 call. Try this: t = 0:.01:20; x0 = [0 0]' + eps; xdot = @(t,x) [0 1; 0...

7 years ago | 1

| accepted

Answered
Symbolic coding calculations problem.
First ‘relevant’ is relative. You left out your syms call, and perhaps others, making it difficult to work with. To simplify...

7 years ago | 0

| accepted

Answered
What does "axes( __ )" mean on the Axes help page?
That construction returns the handle of the axes object. The handle allows you to change the accessible properties of the objec...

7 years ago | 0

| accepted

Answered
How to plot 3 variables (3rd variable on the colorbar)?
That looks like a surf plot, using view(0,90) to create a 2D plot from it. How you plot it depends on how your data are org...

7 years ago | 0

| accepted

Answered
Can i get arc length out of polyval?
Try this (lightly edited version of your code): dfdx = @(f,x) (f(x + 1E-8) - f(x)) ./ 1E-8; % Simple Numeric Derivativ...

7 years ago | 0

| accepted

Answered
How to find a limit without syms and limit function
Crude but effective (for this function, may not be universally applicable): fcn = @(x) (x.^3 - 1) ./ (x - 1); x = 1; lm = fc...

7 years ago | 0

| accepted

Answered
Find optimized solution of linear system of equations
Try this: syms kd kp ki Eq1 = 0.1*kd +0.49 == 18; Eq2 = 0.04*kd +0.1*kp +21.6 == 121; Eq3 = 0.04*kd +0.1*ki +0.98 == 4...

7 years ago | 0

| accepted

Answered
Estimating multiple parameters from a regression
That is a simple linear regression. Try this: B = [x1 x2 u] \ fy; a = B(1) b = B(2) c = B(3)

7 years ago | 0

| accepted

Answered
How to find centroid or center of a 3D irregular shape
The centroid is defined as the arithmetic mean of the points, so just do that in each (x,y,z) dimension.

7 years ago | 0

| accepted

Answered
I want to find code time delay
I have no idea what you are asking. If you want to find out how long it takes your code to run, use the tic (link) and toc fu...

7 years ago | 0

Answered
How can I symbolically solve this system of equations?
Try this: syms B1 B2 g m1 m2 K1 K2 P v1(t) v2(t) x1(t) x2(t) x10 x20 v10 v20 Eq1 = diff(x1) == v1; Eq2 = diff(v1) == (1/m1)...

7 years ago | 1

Answered
Plotting multiple separate lines
Plot them as column vectors, not row vectors. Try this: A = [x1(:) y1(:)]; B = [x2(:) y2(:)]; I am not certain what result...

7 years ago | 0

| accepted

Answered
Output argument "Yeq" (and maybe others) not assigned during call Error Message
The easiest way to avoid that error is to assign all the outputs as NaN initially. The code will then replace them as necessary...

7 years ago | 1

| accepted

Answered
Not enough input arguments error in ode23?
Most of what you are doing appears to be correct (I removed the clc and close calls): tspan=[1 4]; IC=[1;1;-1]; [t,y]=ode23(...

7 years ago | 0

Answered
How to partial derive a matrix with multiple variables
If your matrix is symbolic, see if the jacobian (link) function will do what you want. The gradient (link) function is also an ...

7 years ago | 0

| accepted

Answered
How to iterate xa from 0 to 1 with steps of 0.05 in the function r=F*(k*C*(1-xa))/(1+K*C*(1-xa)). All variables are known except for r.
Everything except ‘x’ are scalars, so you can do this using a vectorization approach without the loop: F=0.11574; k_kin=1.3*10...

7 years ago | 1

| accepted

Answered
How do i detect/describe a curvature from a data-set of coordinates
The polyfit function will not give you the centre and radius of your arc. This will: t = linspace(-pi/4, pi/4, 10); ...

7 years ago | 1

| accepted

Answered
Retrieving a random element from each row in a matrix
It is likely easier to use the sub2ind funciton to create linear indices into ‘R’ from a defined list of random column subscript...

7 years ago | 0

| accepted

Answered
for plot using 'yyaxis left' and 'yyaxis right' how to add separate legends for the two y axes
The legend is for all the data in the plot (or as many as you want to incllude in the legend call). The y-axis labels are diffe...

7 years ago | 0

Answered
how to calculate absolute value for a tf-object for a certain frequency
Thje evalfr (link) function is likely what you want. It requires a complex radian frequency for the frequency argument, so fo...

7 years ago | 0

Answered
How do I only get vectors out of the butter function?
Your filter design has other problems. Your actual sampling frequency is: Fs = 1/mean(diff(t)); or 10, and the Nyquist frequ...

7 years ago | 0

Answered
How can I find a vector in a matrix without using cycles?
Try this: A = [1 2 3 4 5 3 3 1 6 4 4 2]; B = [4 6]; Lidx = ism...

7 years ago | 0

| accepted

Answered
Plotting trajectories of a system of equations.
First, use the matlabFunction (link) function to create anonymous functions (or function files) from your symbolic expressions. ...

7 years ago | 1

| accepted

Answered
Hi, how can i extract the angle from (x,y) coordinates in degrees.
Your best option is likely the atan2d (link) function.

7 years ago | 2

Answered
Index Exceeds number of array elements (1)
I suspect your initial conditions vector in your ode solver call only has one element. It should be a 5-element vector. You ...

7 years ago | 0

| accepted

Answered
How to apply a diff to histogram object?
I have no idea what you wwant. Try this: dH = diff(H.BinCounts); To se all the available fields, do this: histogramField...

7 years ago | 0

| accepted

Answered
exponential with fuction integrate
You need to remove ’exp’ and ‘j’ from your syms call: syms t k w T You want to use the function exp, and the imaginary operat...

7 years ago | 0

| accepted

Load more