Answered
surf plot of custom data
The data are all matrices. Unless I’m missing something, just plot them — LD1 = load(websave('X','https://www.mathworks.com...

4 years ago | 0

Answered
Carve a Pumpkin in MATLAB
I’m not certain what sort of ‘carved look’ you’re going for. With respect to drawing lines on the surface, one approach would b...

4 years ago | 0

Answered
How to add a single legent with multiple subplots with out overlapping on plots?
An alternative — Z = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1161928/Excel.xlsx', 'VariableN...

4 years ago | 0

| accepted

Answered
polyfit returning coefficients in order of ascending power (opposite of documentation)
I get different results — a = [0 1 2 3]; b = [0 1 2 3]; coeff = polyfit(a,b,1) eval = polyval(coeff,a) This is entirely co...

4 years ago | 1

| accepted

Answered
How to solve an ODE with three equation that are dependent on each other
Some of this is difficult to interpret. My best guess at a solution — v1=0.3; k2 = 0.3; %constant C = v1; % C = v1-dpdt;...

4 years ago | 0

Answered
Accumarray for two functions?
The accumarray approach is certainly possible — v = randn(250,1) Out = accumarray(ones(size(v)), v, [], @(x){{mean(x) std(x)}...

4 years ago | 2

Answered
how to plot different plots in the same MATLAB figure to compare time domain specification if the state space representation is given below
Perhaps — A = [-300 0 0 0 0 0; 0 -300 0 0 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1; 10.7206 -9.5648 10.7206 -9.5648 0 0; -9.5648 10.7...

4 years ago | 1

| accepted

Answered
how to plot the gradient of a equation having specific region?
Perhaps this — syms x y f(x,y)=-5*x^3+4*y*x+6*y^3+1 Gf = gradient(f,x) figure fsurf(Gf, [-2 2 -2 2]) xlabel('X') ...

4 years ago | 0

Answered
Reading in a text file with numbers and strings in
It would help to haved the file. The readtable function would likely be best for this, since it will also import the variable...

4 years ago | 0

| accepted

Answered
Extract numbers from char type
Probably the easiest way — s = '4.64 km'; c = regexp(s, '\d*\.\d*|\d*', 'match') n = str2double(c) EDIT — (18 Oct 2022 at...

4 years ago | 2

| accepted

Answered
Shift lables for x and y axis on a graph
Perhaps xticklabels (although it takes a bit of experimenting to get it to work) — figure pcolor(rand(30)) xtl = xticklabels...

4 years ago | 0

| accepted

Answered
Selecting a line of data from a 3D surface
I would use griddedInterpolant for this — x = linspace(-1, 1, 25); y = linspace(0, 5, 35); [X,Y] = ndgrid(x, y); Z = exp(-...

4 years ago | 0

Answered
plot a vertical line on datetime axis of a time series
Perhaps — dt = 1E-2; % Create Data ndp = 1E+4; ...

4 years ago | 0

Answered
design filter to implement in microcontroller
An IIR filter would be more efficient, and an elliptic filter the most efficient of those. The designfilt function may be the e...

4 years ago | 1

| accepted

Answered
How to extract values at particular interval ?
Try something like this — A = randi(9,3,4,48) B = randi([11 19], 1, 48) iv = 1:4:48 ...

4 years ago | 1

| accepted

Answered
How to extract number from this string cell?
Try something like this — C = [") injection-dr0015:138751)" ") injection-dr0015:68761)" ") injection-dr0015:122762...

4 years ago | 1

| accepted

Answered
I get Error using zeros Size inputs must be integers when I change h to be 0.8 or larger. How can I fix that?
I am not certain what you want to do. One option is to divide ‘t’ by ‘h’ — f = @(t,v) (-v*3*t)/(1+t)+2*(1+t)^3*exp(-t); a ...

4 years ago | 0

Answered
Synchronising two different signals
I got this far, however I have no idea what you want to do with them at this point — % clear % close all % datapathECG = %Da...

4 years ago | 0

| accepted

Answered
Solution of a system of ODEs by means of bvp4c
The singlular Jacobian was likely the result of the ‘(1/r)’ term, since ‘r’ initially begins at 0. While changing that removed ...

4 years ago | 0

Answered
How to remove a certain value from all entries of a vector
You can remove the offset and the trend with a highpass (or bandpass) filter. (Use bandpass if you want to elimiinate high-freq...

4 years ago | 0

Answered
Discrete input signal and continuous transfer function
It would likely be best to convert the continuous-time transfer function to a discrete-time transfer function (ideally using the...

4 years ago | 1

| accepted

Answered
Align two plots based on amplitude
Perhaps something like this — t = linspace(0, 10, 1000); y1 = sin(2*pi*t/2.5) + randn(size(t))*0.1; y2 = 1.5*sin(2*pi*t/2.5)...

4 years ago | 0

| accepted

Answered
Finding Unknown Parameters from Monod Equations
The estimated value for ‘theta(1)’ definitely does not appear to be as expected for a rate constant, however if it is than it ...

4 years ago | 0

| accepted

Answered
How do I implement a genetic algorithm for parameter fitting to an already existing ODE system>
Here is some prototype code I developed a while ago that you can adapt to your system — t=[0.1 0.2 0.4 0.6 0.8 1 1.5 2...

4 years ago | 0

| accepted

Answered
How to Hide Legend of Plot 2?
Perhaps — zeys = n; text = ['Run ',num2str(zeys)]; hp1 = plot(x,y,'DisplayName',text); hp2 = plot(xmax,y...

4 years ago | 0

Answered
fminsearch for a function f(x,y) = x^4 -3xy+2y^2
It depends how you set up the function, and whether you use the function by itself or the norm of the function. The easiest w...

4 years ago | 0

Answered
how to calculate the differentiation by diff command ?
The diff function to calcualte the derivative is part of the Symbolic Math Toolbox. To calculate a numerical derivative, use ...

4 years ago | 0

| accepted

Answered
what is the argument I'm missing here? How to fix it?
This call: H_MMSE(: , r ) = MMSEesti(ReceivedPilots(: , r ) ,TransmittedPilots(: , r ), N, pilotFrequency, H_A2(1 ,1:2), SNR);...

4 years ago | 0

| accepted

Answered
2d surface or contour plot of three independent variables
The data are gridded. It is simply necessary to reshape them to plot them — sweep = readtable('https://www.mathworks.com/matl...

4 years ago | 0

| accepted

Answered
Is there a way to store execution times on a disk?
Perhaps tic and toc — s(1) = 0; t0 = tic; for k = 2:10 s(k) = s(k-1) + 1; t_int(k) = toc(t0); end Result = [s; t...

4 years ago | 0

| accepted

Load more