Answered
Match text in cell array and copy to another
This is the best I can do with that. It will likely require a bit of editing later (with respect to the variable names). fil...

5 years ago | 0

| accepted

Answered
How can I plot the integration result?
If you want to plot the cumulative acceleration to get velocity and position, use the cumtrapz function: t = linspace(0, 10); ...

5 years ago | 1

| accepted

Answered
How to do partial differentiation of a function?
This requires the Symbolic Math Toolbox: syms x1 E1 = log((1+x1)/(1-x1)) dE1dx1 = diff(E1,x1) dE1dx1 = simplify(dE1dx1, 50...

5 years ago | 0

| accepted

Answered
How do i get 30% of the data from a vector?
A = [1 7 6 5 3 8 11 23 15 31 4 42 9 82 76 23 41 56 68 90 112] A_1 = A(1:3:end) See Matrix Indexing for details.

5 years ago | 1

| accepted

Answered
How can i changethe value at a position in an array
The ‘k’ array is a (201x201) array of zeros. The code likely works correctly, however using a single index into an array uses l...

5 years ago | 0

| accepted

Answered
why i am not getting fourier transform plot using ezplot command
Since ‘X’ and ‘X2’ are purely imaginary, it is necessary to specify that in the ezplot calls. In MATLAB, imaginary values and i...

5 years ago | 1

| accepted

Answered
Define relationship between variables in an equation
One approach — syms d t eqn = ((t - 21/2)*(d/2 - (20898604612049288806642049279907*t)/70957580590508366543483568128000 + 471...

5 years ago | 0

| accepted

Answered
How to convert the values greater than one to less than one for a matrix stored in workspace
Use rem or mod — v = [1.345, 1.678, 2.345, 3.456, 4.456 0.123 0.456]; vnew = rem(v,1) Using either with the second argument...

5 years ago | 0

Answered
Find an index of a cell whose element satisfies a condition
Try this — c = {[1,2,3], [2,3,1], [3,1,2]}; idx = cellfun(@(x)x(:,2)==1, c, 'Unif',0) Out = find([idx{:}]) .

5 years ago | 0

| accepted

Answered
How to integrate one variable in a multivariate formulation+ nonlinear curvefitting
First, use element-wise operations for everything in the ‘MH’ function. Second, in the integration use the 'ArrayValued',1 na...

5 years ago | 0

| accepted

Answered
Scatter Plot Legend Issue With Assignment
I cannot run the code (no data). That aside, try something llike this — c = [0 0 1; 1 0 0; 0 1 0; 0 1 1; 1 0 1]; figure h...

5 years ago | 1

Answered
How i can get state space model from transfer function?
Apparently you named a script ‘tf2ss’. This overshadows the tf2ss function. The solution is to re-name the script to somethi...

5 years ago | 0

| accepted

Answered
Root finding and plotting
One way is to search for the indices nearest the zero-crossings, then interpolate (if necessary, to get more exact values) — f...

5 years ago | 1

| accepted

Answered
Error using surf (line 71) Data dimensions must agree.. How to rectify this error.
There are too many missing parts to run the posted code. See if this works — surf(t,r,T) .

5 years ago | 0

Answered
Getting an indexing error
In MATLAB, indices must be integers greater than 0. This illustrates a way to get some of the data and plot it — Uz = unzip...

5 years ago | 0

| accepted

Answered
Time between excitation wave and received waves
Try this — F = openfig('sample.fig'); Ax = gca; Lines = findobj(Ax, 'Type','line') sent = findobj(Lines,'DisplayName','Ex...

5 years ago | 0

| accepted

Answered
curve fitting tool plot is different from my plot
I haven’t. Try this, and compare it with your (unposted) code — x = [1.34673 1.35171 1.3531 1.35402 1.35636 1.35875 1.3608 ...

5 years ago | 1

| accepted

Answered
How to solve a function with different ranges
alfa_fcn = @(C_ox) min(C_ox/15,1); C_ox = [16;15;7.5;2;7.5;15;15]; alfa = alfa_fcn(C_ox) .

5 years ago | 0

| accepted

Answered
Finding the indices of the maximum k elements (even if repeated)
One approach — A=[1 1 0 0 2 0 3 3 0 0]; [Amax,idxmax] = maxk(A,3) See the documentation on maxk (introduced in R2017b) for d...

5 years ago | 1

| accepted

Answered
How to create concentric circles?
x_center = 0; y_center = 0; pellet = 0.3355; gap = 0.350; w14re = 0.354; re = 0.355; clad = 0.455; sicfib = 0.458...

5 years ago | 0

| accepted

Answered
Butterworth bandpass filter on a signal using buttord and butter
The transfer function implementation created an unstable filter. Instead, use zero-pole-gain output from butter, then impleme...

5 years ago | 1

| accepted

Answered
Searching for structures in signal
Try this — t = linspace(0,25, 500); % Create Data signal = sum(sin(0.5*rand(5,1)*2...

5 years ago | 0

| accepted

Answered
Root locus imaginary axis intersection
Try something like this — sys = tf([3 1],[9 7 5 6]); % Example From The Documentation [r,k] ...

5 years ago | 0

| accepted

Answered
I can't detect error in formula
The error indicates that the exponentiation needs to be element-wise, using .^ rather than ^ — T3(t,1)=(((q_inc.*z_env.*d_abs)...

5 years ago | 0

Answered
Subroutine using if statement
I generally favour this sort of approach to such prolblems — X = @(x) ((x>=2).*5 + (x<2).*4) + 2; x = 0:20; k = X(x); y =...

5 years ago | 0

| accepted

Answered
Unable To Find Explicit Solution [Empty Syms]
There is no function called ‘T’ so ‘T(0)’ is not defined. Try this instead — syms I(t) Mu To t %Used to decalre variables a...

5 years ago | 0

| accepted

Answered
Merging overlapping circles and remove the union part
One approach — t = linspace(0,2*pi,500); % Allow Adequate Resolution For Best Re...

5 years ago | 1

| accepted

Answered
Creating for loop for a piecewise function
One problem is that MATLAB subscripts are integers greater than 0, so setting ‘V’ to 0 and using it as a subscript will fail. ...

5 years ago | 0

| accepted

Answered
"Array indices must be positive integers or logical values" for i=2 in loop
The error that throws when I run it in the online Run feature has to do with: Fxy2II=@(xxII,yyII,ffiII) 1/E*I*(-3*p*a-p(xxII-a...

5 years ago | 2

| accepted

Answered
FiltFilt function giving NaN values
The signal itself (as well as the value of ‘srate’) may be important here. (The factor of 2 is not necessary.) I have no ide...

5 years ago | 3

Load more