Answered
3D plot from excel
Try something like this — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/616758/Shear%20stress...

5 years ago | 1

| accepted

Answered
Adding a single number to an entire matrix
Exactly as you wrote it! a = 5 b = [1,2,3;4,5,6;7,8,9] c = a + b Use square brackets [] to code vectors and matrices.

5 years ago | 1

Answered
Frequency domain and time-frequency domain for sae data
The pspectrum function can likely help with this, specifically with respect to the time-frequency plot.

5 years ago | 0

| accepted

Answered
Help with conditional statement
My approach to these problems is to take advantage of MATLAB’s logical vectors. So for example, if I wanted to construct a fu...

5 years ago | 1

Answered
Add constraints to nonlinear multiple data sets fit
The nlinfit function will not allow parameter constraints. Use lsqcurvefit for that instead. Note that it is then possible t...

5 years ago | 0

| accepted

Answered
Use input from an array in a function
The ‘plan’ array is not being passed to your function, and since the function has its own workspace (that it does not share with...

5 years ago | 1

| accepted

Answered
Solving state space equation by ode45
The MATLAB ODE solvers are adaptive, and so will solve with as narrow a difference in the time steps as necessary to produce a s...

5 years ago | 0

| accepted

Answered
How do i write this differential equation in matlab?
There are several options, including using the numerical solvers. This approach uses the Symbolic Math Toolbox — syms C R u...

5 years ago | 0

| accepted

Answered
Multiplication of envelope function to that of sine wave
I would just use the same value (either ‘t’ or ‘ts’) for both — t = 0:1e-4:0.1; ts = 0:1e-4:0.4; T = [t ts]; x = (1+square(...

5 years ago | 0

| accepted

Answered
Read a table with numbers and strings
I would use the readcell function (introduced in R2019a), then create a table from the processed data to determine how best to r...

5 years ago | 2

| accepted

Answered
High-pass filter
It could work, however a better option could be: Fca = 2; Fsa = 1000; ...

5 years ago | 1

| accepted

Answered
Please explain how do I get A and E from the question?
It is not obvious to me how the file data relates to the expression. I assume this was discussed in class, or in other parts of...

5 years ago | 0

Answered
Can you please explain how did he found the function?
I am not certain what you are asking. If it is to understand this — fun=@(x,V,F,k,n,c0) (x./(k*c0^n*(1-x).^n))-V/F; % param...

5 years ago | 0

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

Load more