Answered
displaying 2 graphs in singe run
‘... but evry time it replace the first graph ...’ It does not replace them. It creates a second figure and that figure is o...

5 years ago | 0

| accepted

Answered
Find two x values for one y value
C=1*10^(-4); L=3*10^(-1); R=100 N2=100; frez=1/(2*pi*sqrt(L*C)) %f value for Imax(theory of RLC c...

5 years ago | 1

| accepted

Answered
Finding position of main peak and difference between main peak and next peak in a 1d plot
x = linspace(0,10); y = 1.5*exp(-(x-2).^2) + 2*exp(-(x-7).^2*2.5) + exp(-(x-9).^2*5); [pks,locs] = findpeaks(y) [maxpk,...

5 years ago | 0

| accepted

Answered
string data in function
Perhaps something like this — data('Character Vector', pi, 42) data("String Variable", pi, pi) function data(a,b,c) displ...

5 years ago | 0

| accepted

Answered
Printing an error message if jacobi's method, does not converges.
One approach would be to set a limit on ‘itc’. If it fails to converge before ‘itc’ reaches some value (perhaps ‘iteration_limi...

5 years ago | 0

| accepted

Answered
Solve a system of two second-order differential equations using ode
Start by using the Symbolic Math Toolbox to set the equations up, then use odeToVectorField and matlabFunction to create an anon...

5 years ago | 0

| accepted

Answered
How to fit a log curve to a scatterplot?
If you have the Statistics and Machine Learning Toolbox, use the lsline funciton. Otherwise use polyfit and polyval. x =...

5 years ago | 0

Answered
The inbuilt code "bode " is not working
The same code works here, and runs without error, with either bode or bodeplot. I switched from bode to bodeplot because bode...

5 years ago | 1

| accepted

Answered
How to make a cross section of the 3D plot ?
Choose the appropriate ‘X’ and ‘Z’ (or ‘Y’ and ‘Z’) values from the matrix to get a cross-section. [X,Y,Z] = peaks(50); fi...

5 years ago | 2

| accepted

Answered
lsqcurvefit to estimate parameters in ODE15s
The problem is in the definition of ‘theta0’ and not including the initial conditions in ‘theta0’. Changing those produces — ...

5 years ago | 0

| accepted

Answered
Findpeaks from the excel data graph
To create a logical vector for ‘J’, just do: J = (x2>90 & x2<120); Then the reference to it works correctly. However there...

5 years ago | 0

| accepted

Answered
Filter data series on amplitude as a function of time
Try this — s = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/632075/data.txt'); t = linspace(0,n...

5 years ago | 0

| accepted

Answered
How to solve equation by iteration
One problem is that ‘Psi’ is used before it is defined. Preallocating fixes that, however it may not solve the larger problems....

5 years ago | 0

| accepted

Answered
Bifurcation Diagram will not graph
Plot the points — figure; ax(1) = axes; hold on xlabel ('k'); ylabel ('C'); xlim([-2 2]); ylim(...

5 years ago | 0

Answered
How do ı convert rad/sample to Hz?
Note that radians/sample is equivalent to the Nyquist frequency, one-half of the sampling frequency. In fvtool, click on the...

5 years ago | 1

| accepted

Answered
How to filter a signal with a transfer function?
The easiest approach is to first let the Control System Toolbox solve it, then realise it as a discrete filter using the numerat...

5 years ago | 0

| accepted

Answered
Vertical and horizontal line standard equations
The problem is that the axes are set to be limited to [0 1] while the lines are all negative. (The second line was originally c...

5 years ago | 0

| accepted

Answered
Matlab contour plot with color
Use the contourf function, and choose the colormap that most closely represents what you want (for shades-of-gray, the gray colo...

5 years ago | 0

Answered
plot 3D function
I have no idea what ‘plotn’ is. That aside, ‘X’, ‘Y’, and ‘u’ are all (40x40x40) matrices. To plot them as a mesh for exampl...

5 years ago | 0

| accepted

Answered
problem with the function y
Define it as a function. (This has been possible since R2012a.) syms x T(x) = taylor (asinh (x), x, 'Order' ,16); figure...

5 years ago | 1

| accepted

Answered
Issues with my Bifurcation Diagram
One problem is that ‘ax(1)’ does not have anything assigned to it, at least in the posted code. Fixing that makes the axes magi...

5 years ago | 0

Answered
read Barcode is showing error- Undefined function or variable 'readBarcode'.
According to the documentation, the readBarcode function was introduced in R2020a. The version posted is R2019a, so to use it...

5 years ago | 2

Answered
Quiver is not working about drawing vector field.
It appears to work correctly here — x = linspace(-2, 2, 40); y = linspace(-2, 2, 40); [X,Y] = meshgrid(x,y); Z = (x.^2 + Y....

5 years ago | 0

Answered
Invalid expression on using log(t) and [exp(t) * cos(t)] functions
There are too many parentheses in ‘V’. Also, it is necessary to use element-wise operations in the vector calculations. See ...

5 years ago | 0

| accepted

Answered
scatterplot with the datetime
One approach — Uz = unzip('https://www.mathworks.com/matlabcentral/answers/uploaded_files/630240/household_power_consumption_2...

5 years ago | 2

| accepted

Answered
X-ray diffraction (XRD) Base line removal
See if the detrend function will do what you want. (This appears to be a relatively straightforward application of it.) More ...

5 years ago | 7

| accepted

Answered
How do I detect the desired peaks
‘There are multiple data points between the peaks, so finding two maximas would not work.’ It would definitely help to have a...

5 years ago | 0

| accepted

Answered
Using datenum to calculate acceleration
I’m not certain that I understand in detail what you’re doing. Using datenum is likely the best option here. I experimented ...

5 years ago | 0

Answered
How to prevent readtable excluding rows with "NA"?
Try this — C1 = readcell('https://www.mathworks.com/matlabcentral/answers/uploaded_files/629630/exampletxt.txt'); VN = C1(1,:...

5 years ago | 0

| accepted

Answered
inverse of tan at 90 degree
A more robust approach would be atan2d, since it provides a 4-quadrant angle. y2 = 20; y1 = 10; x2 = 42; x1 = 42; The...

5 years ago | 0

Load more