Answered
How do I read residuals from a model fit?
Try this instead: r = mdl.Residuals.Raw MATLAB prefers that you use its exact names with respect to its structures and struct...

8 years ago | 1

Answered
Find maximum of a function 2 variables
Using the Symbolic Math Toolbox for an optimisation problem is probably not appropriate. Try this: f = @(x,t) (2-x^2*(sin(t...

8 years ago | 0

Answered
convert probability to z-score
To calculate the z-score from a normal distribution probability, use the norminv (link) function.

8 years ago | 2

| accepted

Answered
how to use for loop?
Unless you absolutely must use a loop, use the strfind (link) function: a = [1,2,3,1,2,3,4,1,2]; b = [1,2]; c = strfind(a,b)...

8 years ago | 0

| accepted

Answered
filt-filt function Error: First denominator filter coefficient must be non-zero.
I’m not entirely certain what you want to do. However assigning ‘1’ to the numerator usually works for FIR filters. Try this...

8 years ago | 0

Answered
How can I plot the spectrum of two segments from this signal?
Try this: D = load('signals (1).mat'); Signal = D.Signal; ...

8 years ago | 0

| accepted

Answered
Plot as a decimal and not a fraction
The rats (link)call will produce a fraction. Change that to something else if you want a decimal output. Example — m = ...

8 years ago | 1

| accepted

Answered
Does line() function works in matlab R2015b ?
‘So. does MATLAB R2015B support line() function ?’ The line (link) function was ‘Introduced before R2006a’ according to the doc...

8 years ago | 2

Answered
Hey i could use a small help with the For loop
Subscript ‘K’: for i=1:10 x=input('X wert Knote='); y=input('Y Wert Knote='); K(:,i) = [x;y]; end That should ...

8 years ago | 1

| accepted

Answered
If I have a plotted curve with a small gap in the midlle, how can I fill the gap with a straight line?
I have no idea what your curve is or the reason the gap exists, so this is a guess. The approach to both is to find the ends of...

8 years ago | 0

| accepted

Answered
Mesh 3-D plot axes position
Another option that appears to have worked well: Rotate X and Y axes with a bar3 plot (link).

8 years ago | 0

Answered
How to create a filled circle?
One option is to use the fill (link) function: function circles = circle(x,y,r,c) hold on th = 0:pi/50:2*pi; x_circle = r *...

8 years ago | 2

Answered
Combining cells into a single cell
See if the cat (link) or cell2mat (link) or both will help solve your problem. Example — M{1} = rand(3,4,2); M{2} = rand(3...

8 years ago | 1

| accepted

Answered
problems with using the laplace transform
First, specify ‘Y1’ and ‘y1’ as functions in your code. Second, use the vpa function to simplify ‘y1’ so ezplot (or fplot) ca...

8 years ago | 0

| accepted

Answered
To find the location of maximum number
Use the find (link) funciton: a= [1 2 5 7 7 5 3]; allmaxidx = find(a == max(a(:))) producing: allmaxidx = 4 5 ...

8 years ago | 0

| accepted

Answered
How to find NaN in a matrix and delete it?
You have the logical negation ‘~’ in the incorrect position. Example — A = rand(4); A(2,3) = NaN; A(3,4) = NaN Q1 = ~(an...

8 years ago | 1

| accepted

Answered
Rotate X and Y axes with a bar3 plot
Try this: A=[3 5 7; 7 3 9; 5 2 1]; figure bar3(A) view(32, 18) Tweak the angles in the view (link) call to get the result ...

8 years ago | 3

| accepted

Answered
Symbolic Expression Sum Same Denominator
Try this: syms a b c Eqn = (3*a)/8 + (3*b)/8 + c/4 [Eqnn,Eqnd] = numden(Eqn) producing: Eqnn = 3*a + 3*b + 2*c Eqnd...

8 years ago | 0

Answered
How to solve an non linear equation with 2 experimental variables (with 10 data points) to find the constant coefficients?
If you are fitting data, consider something like this: syms nex rhog n0 D rhoa Eqn = log(nex) == log(n0) + log( 1 - rhog/rho...

8 years ago | 0

| accepted

Answered
How to make simpler this at 'if condition'?
I am not certain this is more efficient than your code, however it takes advantage of the repeating patterns to make it simpler:...

8 years ago | 1

| accepted

Answered
How can I fit a nonlinear differential equation?
Several examples: Monod Kinetics and Curve Fitting (link) Solving Coupled Differential Equations (link) Parameter Estimatio...

8 years ago | 0

| accepted

Answered
ode45 returns NAN, HOW could I modify it?
After about ‘t=60’, your differential equation saturates (becomes greater than realmax (link)), and subsequent values are NaN. ...

8 years ago | 0

Answered
why nanmean error?
You may have your own function or a variable that you named ‘nanmean’. Run this from a script or your Command Window: which...

8 years ago | 0

| accepted

Answered
how can i account for the last variable of a vector while comparing the n and (n+1) variables?
You can keep it from over-writing the vector by having it take the minimum of the ‘(i+1)’ index and the number of elements in th...

8 years ago | 0

| accepted

Answered
solving an integral to get a numerical answer
First, you can probably use the double function, or the vpa function first, then double. Second, your code throws this error:...

8 years ago | 0

| accepted

Answered
How to linearize a function?
Calculate the partial derivative of your function with respect to each variable, then add the value of the original function nea...

8 years ago | 1

Answered
Help with finding zeros of a complex function
If you want reasonably close results for the roots: g = @(z) z.*exp(z)./((z-pi).*cos(z)); zv = linspace(-10, 10, 5000)*pi; ...

8 years ago | 1

Answered
Edge Finding Program to Fix Data?
It appears that the discontinuities in the blue line near the regions you likely want to ‘correct’ (if I understand your Questio...

8 years ago | 0

Load more