Answered
How to get multiple circles to rotate about a point
Try something like this — a = linspace(0, 2*pi, 30); r = 1:3; cm = colormap(turbo(numel(r))); figure for k1 = 1:numel(...

5 years ago | 0

Answered
Struggling to plot the data over timestamps!
I am resisting the temptation to copy all of those, that should be in a text or spreadsheet file and attached here, anyway. I...

5 years ago | 0

| accepted

Answered
What should be the X, Y, and Z axes while plotting the contour plot?
If ‘sigmaX’, ‘sigmaY’ and ‘sigmaXY’ are vectors, use the griddata to create a matrix from them that can be plotted. Example —...

5 years ago | 1

| accepted

Answered
How can I fix this error?
The problem is that ‘G’ is a system object, not a matrix. To use smithForm on the ‘A’ matrix — Ad = [-3 5 -7 0; 0.5 -1.5 0.5 ...

5 years ago | 0

| accepted

Answered
How to generate a signal
I would use the interp1 function — x = linspace(0, 0.015, 41); % Independent Variable y = randn(size(...

5 years ago | 0

| accepted

Answered
I don't know what this genetic algorithm output graph means :(
The documentation describnes it better than I can, so I refer you to the documentation section on Plot Options. It describes al...

5 years ago | 0

Answered
How to calculate the largest difference between peaks?
The findpeaks function can produce the ‘prominence’ value of each peak as the fourth output, p. I would use that value to deter...

5 years ago | 0

Answered
Can anyone help me identify what is wrong with this code
Try this instead — for i=2:length(arr) diff(i) = arr(i) - arr(i-1) %I keep getting an error on line 4 end Be sure that ...

5 years ago | 1

| accepted

Answered
Real part of the Fast Fourier Transformed data file.
‘Any suggestions what might be the reason, do I have a mistake in the code?’ The code appears to be reasonable, although with...

5 years ago | 0

Answered
error: fzero: zero point is not bracketed
Use fzero for numeric functions and solve for symbollic functions — syms x f=4*x.^2+20*x+4 x=vpa(solve(f==0)) format long...

5 years ago | 0

Answered
Cumtrapz in a table does not work with datetime
Use the datenum function to convert the dates and times to decimal days and decimal fractions of days to use as the ‘x’ vector i...

5 years ago | 0

Answered
bilinear interpolation of a 3D graph
Missing data, so I can’t run the code to demonstrate the approach. Since the data appear to be gridded (not scattered), the g...

5 years ago | 0

| accepted

Answered
How do I put peaks, prominences, widths and location in an array
Since ‘prominence’ is the first output of that particular findpeaks call, it has the values of the peaks, not their locations (t...

5 years ago | 0

| accepted

Answered
Trying to open/read a .xlsx file in MATLAB
The type function will display the contents of a file. The disp function (or simply removing the trailing semicolon from the ...

5 years ago | 0

| accepted

Answered
Separating numbers and letters
One approach — Coords = cell2mat(compose('%.1fN',rand(1,5)*100).') % Create Column ReadNrs = cell2mat(textscan(...

5 years ago | 0

| accepted

Answered
how to control amplitude of step in code
Use stepDataOptions to create an options structure, and specifically the StepAmplitude option — A = randn(3) ...

5 years ago | 0

| accepted

Answered
Store spectrogram with image data format in the MATLAB workspace
I would use the saveas function on the created figure to save it to whatever format is desired (and supported).

5 years ago | 0

| accepted

Answered
how to pass values from a .txt file
Reading the file was another interesting challenge! Try this — T1 = readtable('https://www.mathworks.com/matlabcentral/answ...

5 years ago | 0

| accepted

Answered
Filled Contour Plot Error
Request more contour levels (here I requested 150) — func=@(x,t) (16/3).*(12.*((-4)+4.*exp(1).^(8.*((-1/16)+(-2).*t+x))).^(-...

5 years ago | 1

| accepted

Answered
Setting the xlim for datetime data
Perhaps something like this — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/851315/collated...

5 years ago | 1

| accepted

Answered
Solving a nonhomogeneous ODE system with 'dsolve'
I have no idea what the problem is with this, however I’ve been running it offline on my computer (using a Laplace transform app...

5 years ago | 0

Answered
2D Plot of CSV data
One approach — M = [31.999999999999964 0.19038773875061182 323.5661344306932 31.980976178007637 0.200000...

5 years ago | 0

Answered
replace the equations in the code with the equations in the picture
Assuming these are coded correctly (there appear to be missing and unmatched parentheses) — syms I_o Lambda I_sc R_s I_ph R_sh...

5 years ago | 0

| accepted

Answered
Solve a system of ODEs with varying coefficients
‘Note: kappa(s) and tau(s) vary with s’ Duly noted. I made some changes. See if this produces the desired result — kapp...

5 years ago | 0

Answered
How to implement Reference tracking and control for level of hypnosis in Patients through a pharmacokinetic and pharmacodynamic model.
Unless I missed something in the problem statement, the initial goal is to estimate the parameters. A linear model with identif...

5 years ago | 0

Answered
How of get Initial values of a pharmacokinetic and pharmacodynamic model.
First, supply some of the relevant research papers (as PDFs, since I have personal access only to some medical journals and Scie...

5 years ago | 0

Answered
How can i write this code and plot it on matlab?
I would be tempted to use the Control System Toolbox — R= 10; % k ohm. L = 14.95; % mH C= 0.018013; % pF s = tf('s'); H...

5 years ago | 0

| accepted

Answered
How do i plot one best fit line for multiple data sets?
I would do something like this — x1 = 0:0.5:10; x2 = x1 + 2; x3 = x1 - 0.5; y1 = 1 + 0.2*x1 + randn(size(x1))*0.2; y2 = 1....

5 years ago | 2

Answered
Filtering doubles in a struct by criteria of one double
It seems to work correctly when I run it with random data — % site_data.wlH13 = randn(1,15); % Vect...

5 years ago | 0

Answered
prctile how to calculate
See the prctile documentation section on Algorithms. .

5 years ago | 0

| accepted

Load more