Answered
Fit an exponential curve
Try this — x=[6.5 2.45 2.7 1.85 2.25 1.35 1.4 1 0.7 .475 .66 .475]; y=[0.40 0.80 1 1.40 1.80 2.50 3.00 4.00 6.00 7.00 8.00 9....

5 years ago | 0

| accepted

Answered
I don't understand how to use the sgolay function for signal edges
That code snippet runs for me without error in R2021a (and in the online Run feature, also using R2021a). I suspect you are u...

5 years ago | 0

Answered
How to change order for different filters?
Those functions have a second output, the digitalFilter object. Return that and all the information you want about the type of ...

5 years ago | 0

| accepted

Answered
How can i add text in animated line
Try this — figure h = animatedline('linewidth',2); axis([1 7 1 7]) axis ij grid on x=1:4; n = 100; xx=linspace(x(1),x...

5 years ago | 0

| accepted

Answered
Stop line after intersection with other line
I am not certain what you want. If you want lines to only go an intersection of another line, try something like this — x = l...

5 years ago | 1

| accepted

Answered
How to skip parameters in a function call
See the documentation section on Support Variable Number of Inputs for a demonstration of how to do that.

5 years ago | 1

| accepted

Answered
Multiply matrix by each element of a vector without a for loop
This may be considered ‘cheating’, however it does meet the requirements: A = [1,1;1,1]; v = [1,2,3]; vr = repelem(v,2,2) A...

5 years ago | 0

Answered
Building a wrapper around script
This appears to run correctly, saving ‘t’, ‘v’, and ‘r’ as cell arrays. (I limited ‘total_i’ and ‘j’ each to 2 in my test.) I ...

5 years ago | 0

| accepted

Answered
Plot with 3 Variables
If I understand correctly, the scatter function (or a combination of scatter and plot if you want the points connnected with l...

5 years ago | 1

| accepted

Answered
How can I extract exact values from a single column of a matrix?
Try something like this — M = randi(50, 50, 3)/1000 % Original Matrix Lv = M(:,1) == 0.025 ...

5 years ago | 0

| accepted

Answered
Why do I get "array indices must be positive integers or logical values" when trying to solve a differntial equation?
Express ‘Dx’ as a function of ‘t’ — syms x(t) Dx(t) = diff(x(t)); equ = diff(x,2) == -6*diff(x(t))-6*x-cos(3*t)-10*sin(3*t...

5 years ago | 0

Answered
merge two arrays into one
One option is simply to add them: charge_amount = [ 1 2 3 4 5 0 0 0 0 0 1 2 3 4 5]; discharge_amount = [ 0 0 0 0 0 -1 -2 -3 -...

5 years ago | 0

| accepted

Answered
Change stem colour of particular values
Try something like this — x = 1:10; y = rand(size(x)); figure stem(x, y) hold on stem(x([1 3 5]),y([1 3 5]),'g', 'Marke...

5 years ago | 0

| accepted

Answered
why I am getting 'array indices must be positive intergers or logical value' error?
Some of the posted code makes no sense, especially the break call in the for loop, since that will result in only the first valu...

5 years ago | 1

| accepted

Answered
Plotting a point in Matlab
One approach — x = pi; y = pi; figure plot(x, y, 'p') grid figure plot(x, y, 'p', 'MarkerSize',50) grid .

5 years ago | 0

Answered
getting error in line 5 please help
The error refers to ‘x2’ not being defined in ‘functin’: functin=@(x) (3*(-1-212*x)^2+(-1-212*x)-4*(4-170*x)-7)^2+(4-170*x-1-2...

5 years ago | 0

Answered
displaying symbolic function without i or j in the denominator
The usual procedure is to multiply the numerator and denominator by the complex conjugate of the denominator: syms omega tau r...

5 years ago | 0

| accepted

Answered
How do I convert descriptor state-space to transfer function?
This seems to work: A = [1 2; 3 4]; B = [5; 6]; C = [7 8; 9 10]; D = 0; E = [11 12; 13 14]; ss_sys = dss(A,B,C,D,E) tf...

5 years ago | 0

| accepted

Answered
have 3 chifre after E
One approach — expstr = @(x) [x(:).*10.^ceil(-log10(abs(x(:)+(x==0)))) floor(log10(abs(x(:)+(x==0))))]; % Updated: 2021 ...

5 years ago | 0

Answered
Save double vector in text file
Change the line that writes the vector to: fprintf(fileID, "%d ", midval); That should work, if you want to write each vector...

5 years ago | 0

Answered
How can i integrate this expression which includes matrices?
Try this — A = [1 2; 3 4]; B = [5; 6]; B_d = integral(@(sigma)expm(A.*sigma), 0, 1, 'ArrayValued',1)*B See the documentat...

5 years ago | 1

| accepted

Answered
data to transfer function (idfrd) error
If you want to see how well the data and identified system match, use the compare function.

5 years ago | 0

| accepted

Answered
s it possible to have double subscript in a figure label
I am not quite certain what you want, however that is possible. Using a LaTeX interpreter with: $A{_B}_C$ produces: So...

5 years ago | 1

| accepted

Answered
Problem using ode23, must return a column vector.
Multiply ‘dy’ by an appropriate vector of ones and it works. You need to determine if it produces the correct result. % K1...

5 years ago | 0

| accepted

Answered
How can I store the value of a variable from a function which is used by ode45?
I don’t see ‘u’, only ‘u1’ and ‘u2’. One solution is to not use numbered variables here (thiat might otherwise be appropriate...

5 years ago | 2

| accepted

Answered
anonymous function w/ accumarray
Naming your function ‘cat’ overshadows the existing MATLAB function by that name, that you inadvertently called when you used th...

5 years ago | 0

| accepted

Answered
How do I solve this problem at the optimization toolbox?
It would llikely be easier to just call ga from a script — lb = [-10 -6]; ub = [ 10 6]; nvars = 2; [Xr,fval,exitflag,outpu...

5 years ago | 0

| accepted

Answered
Command use to convert expression E to numeric form
If ‘E’ is a symbolic expression (we have no idea exactly what it is), then matlabFunction could be appropriate to turn it into a...

5 years ago | 1

Answered
first five natural frequencies
This was something of a challenge! I ended up dokng some of it offline because it took longer than the 55 seconds allowed in ...

5 years ago | 0

| accepted

Answered
I am not getting the meaning of this line k = 1:sze_x, what 1 signifies here? and what is the meaning of sze_x = size(x,2), what 2 signifies here?
The size function returns the maximum dimensions of its argument array, and the ‘2’ refers to the number of columns (second dime...

5 years ago | 0

| accepted

Load more