Answered
Array indices must be positive integers or logical values.
That notation only will work in the Symbolic Math Toolbox. Use Anonymous Functions to create functions for numeric calculations...

5 years ago | 0

Answered
How to convert consecutive numbers in NaN?
Try this — y = [1 2 3 5 2 6 4 8 0 5 2 0 0 0 0 0 0 0 0 0 0 1 2 5 6 9 8 74 0 0 0 32 8 4 6 1 10 2]'; y = [y;y;y; zeros(8,1)]; ...

5 years ago | 0

| accepted

Answered
Counting amount of digit occurrence in a cell
Try something like this — CellArray = num2cell([2; 2; 2; 2; 2; 2; 2; 3; 9]); [Uc,~,ix] = unique([CellArray{:}],'stable'); Co...

5 years ago | 1

| accepted

Answered
Interpreting FFT Graph with Noise Floor
Try this — X = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/613760/tapedata.csv'); t = readmatr...

5 years ago | 0

| accepted

Answered
Bar plot how to create it
Use the bar and plot functions. The cross-hatching is not a standard option, so it will likely be necessary to simply use sol...

5 years ago | 0

| accepted

Answered
i have Question about Inverse lapalce transform & plot
Try this — syms s R = 1/s G = 75/(s)^2+10.25*s+100.65 F = R * G a = ilaplace (F) % x = t t = [0 10]; y = a; fplot(y,t)...

5 years ago | 0

| accepted

Answered
Changing size label in xline
Try this — x = linspace(0,6,100); y = exp(x); plot(x,y) hxl = xline(4.5,'-',{'Acceptable','Limit'}); x = linspace(0,6,...

5 years ago | 0

| accepted

Answered
Is there FWHM function in frequency domain
Try it — a = 2; p = @(t) exp(-(a*t).^2) t = linspace(-5,5); figure plot(t, p(t)) grid P = fft(p(t))/numel(t); Ts ...

5 years ago | 0

| accepted

Answered
How to use 'trapz' command in a foor loop
The problem is that ‘S_v’ has only one non-singleton dimension (i.e. it is a vector). That is throwing the error. Chan...

5 years ago | 0

| accepted

Answered
Matlab solves differential equations but returns empty plots
It is not possible to do anything with the images provided. Perhaps something like: Fds = vpa(Fds) figure fplot(Fds) a...

5 years ago | 0

Answered
How to rotate 3D surface matrices
It depends on what you want to do. To rotate the surface in the axes, use the rotate function. To change the viewpoint (ca...

5 years ago | 0

| accepted

Answered
Plot discrete fourier transform of a sine wave
Try this — f = 6000; fs = 16000; w = 2*pi*(f/fs); N = 50; n = 0:N; y = sin(w.*n); subplot(2,1,1); stem(n,y); f = -...

5 years ago | 1

| accepted

Answered
Develop a cleaner stem plot (Magnitude Spectra)
These are two-sided fft plots. I’m not certain what ‘cleaner’ is in this context, however using the fftshift function, then c...

5 years ago | 0

| accepted

Answered
How to solve Coupled Differential Equations
Try this — syms x(t) y(t) x0 y0 Dx = diff(x); Dy = diff(y); ode1 = Dy-Dx == 2 - x ode2 = 2-Dy - Dy == 3 + 2*y S = dsolve...

5 years ago | 0

Answered
How to interpolate a matrix ?
Try this — M=[ 3.2 5 4.1 4 5.6 3 6.7 ...

5 years ago | 0

| accepted

Answered
Vector counting syntax help?
Try this — A = [1 1 1 1 2 3 3 5 5 5 5 6 6 7]; [Au,~,ix] = unique(A,'stable'); Count = accumarray(ix,1); Result = table(Au(:...

5 years ago | 0

| accepted

Answered
How to get multiple variables in 'assume' ?
Declare them in the syms call as positive. MATLAB defines positive as values greater than 0. See the documentation section o...

5 years ago | 1

| accepted

Answered
signal does not show filtered, using filter()
Use freqz to see what the filters are actually doing — Fs1 = 500; %Sampling Frequency ync = [.25, .5, .25]; ync1 = [-.085 ....

5 years ago | 0

| accepted

Answered
Trying to fit parameters for an ODE model to real data using lsqcurvefit
‘... I can't seem to find any real differences between the code I've constructed and that example.’ I agree that the initial ...

5 years ago | 0

| accepted

Answered
how take a mathematical function from user
I would use the inputdlg function — prompt = {'Enter f(x,y):', 'Enter g(x):'}; response = inputdlg(prompt) f = str2func(['@(...

5 years ago | 0

Answered
Characteristics of a step response plot
Try something like this (using a transfer function from the documentation) — sys = tf([1 5 5],[1 1.65 5 6.5 2]); stinf = step...

5 years ago | 2

Answered
I want to separate the signal from the noise with the help of a low pass filter.
I could not figure out which of those signals you want to filter, so I arbitrarily chose ‘t1’ and ‘y1’. They are not consiste...

5 years ago | 0

| accepted

Answered
How to change X axis in the form of percentage
Try something like this — x = linspace(77, 146); y = -60 - 15*sin(2*pi*x/50); figure plot(x, y) Ax = gca; xt = Ax.XTick...

5 years ago | 1

Answered
Plotting a filter as a function of cyclic frequency using freqz()
Your approach is correct. The reason the freqz plot did not look correct is that you were passing the filtered signal to it, no...

5 years ago | 0

| accepted

Answered
How to tell matlab that y is a function of x; not a constant
In the initial syms call, declare ‘y(x)’ instead of ‘y’ — syms x y(x) z z=x*y; Dz = diff(z,x) ...

5 years ago | 1

| accepted

Answered
Adding text to each subplots
Use xlim and ylim to make the text positions relative to the axes — x1 = linspace(0,10, 25); y1 = exp(-0.1*x1); x2 = linspac...

5 years ago | 0

| accepted

Answered
Error in App Designer " Undefined function 'sym2poly' for input arguments of type 'char'.."
Apart from the app code, apparently the numerator and denominator polynomials are not being transofmred into symbolic variables....

5 years ago | 1

| accepted

Answered
CIplot unable to fill on log-x axis
I am not certain what you are doing. However in many situations, it is easier to initially plot in a linear scale, then afterwa...

5 years ago | 0

| accepted

Answered
Numerical integration using Trapz
That should produce one scalar value as ‘F’, so the subscripts are not necessary. I would do something like this — F = trap...

5 years ago | 0

| accepted

Answered
Data is not importing? SOS
It is not importing because the correct approach to reading .wav files is to use audioread. Try that. It should do what you ...

5 years ago | 0

Load more