Answered
Why do I get NaNs when I try interpolating with interp1?
It will do that if you atempt to extrapolate without telling interp1 how you want to do it. Try this — interp_co2 = interp1...

5 years ago | 1

Answered
plot 3D grid using mesh() with lack of individual data
It would be best to have your data, however an illustration of the procedure using the fillmissing function is — . x = 1:11; ...

5 years ago | 1

| accepted

Answered
How to solve quadratic equation in x and y?
I am not certain what solve is in this context. Plotting the function is straightforward — syms x y f(x,y) = 3*x^2 - 6*...

5 years ago | 1

| accepted

Answered
Trying to get S(100) value several times
The value after 100 iterations of the ‘t’ loop will be the last value of ‘S’, so subscript it with the index of the outer loop t...

5 years ago | 0

Answered
how to import date with other variables from the XLX file.
I would use the readtable function — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/760931/M...

5 years ago | 0

| accepted

Answered
HOW DO I USE AVERAGEIF(excel) IN MATLAB?
The groupsummary function is also an option — g = {'Male';'Female'}; allSamples = table(randi([60 99],20,1),randi([160 210],2...

5 years ago | 0

| accepted

Answered
calculating angle between line of best fit and x axis
The slope is simply the tangent, so — slope_angle = atand(p(1)) % Slope Angle (°) Here, tha...

5 years ago | 1

| accepted

Answered
Can someone tell how I should code this equation for plot
That would work (with multiplication operators) in the Symbolic Math Toolbox — syms t x(t)=0.8*cos(14*t) figure fplot(x,...

5 years ago | 1

| accepted

Answered
Lower and upper bounds in optimization technique
Create appropriate vectors for each bound. Specify the bounds for the parameters that have bounds, and +Inf and -Inf for those ...

5 years ago | 0

| accepted

Answered
How can I create a shaded plot like the figure sample shown here?
Try something like this, using patch — x = linspace(70, 130, 12); y = rand(2, numel(x)); figure plot(x, y) grid hold ...

5 years ago | 1

| accepted

Answered
How to analyze different segments in a timetable?.
Try this — LD = load('timetable.mat'); AB001 = LD.AB001; ExptMarker = AB001.fTimeMark; % Marke...

5 years ago | 0

| accepted

Answered
Why do the y axes have different lengths although they have same limits?
I do not understand what change is desired. Apparently ‘BH-1’ and ‘BH-2’ display different sets of data, however all the axes...

5 years ago | 0

Answered
set Y-Axis to descending order without changing data
I am not certain what the code actually does. It seems to me that there are two options — set(gca, 'YDir','reverse') yt =...

5 years ago | 1

| accepted

Answered
i can't plot this function in matlab
The code is correct except for the plot arguments. In the plot, it is necessary to plot the real and imaginary parts aginst ‘t...

5 years ago | 0

Answered
Show the xticks in the view of 2D
The default tick direction is 'in', so the x-ticks are not visible in the second plot. Set TickDir to 'out' or 'both' to see ...

5 years ago | 0

| accepted

Answered
how to linear interpolate using a for loop
x = linspace(-50, 50, 250); y = x.^2 -2; zx = find(diff(sign(y))) for k = 1:numel(zx) idxrng = max(1,zx(k))-2 : mi...

5 years ago | 0

| accepted

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values.
To reference ‘Z’ as a matrix, ‘lat’ and ‘lon’ must be integers greater than 0, or logical values. The griddata function may b...

5 years ago | 0

Answered
Converting frequency domain to Time Domain using IFFT.
I made some assumptions and managed to invert the frequency-domain signal — T1 = readtable('https://www.mathworks.com/matlab...

5 years ago | 1

Answered
How to add a line to a freqz plot?
Since freqz plots are ordinary subplots, just address them as such — Fp = 1000; %Bandpass Freq Fs = 2000; %BandStop Freq ...

5 years ago | 1

| accepted

Answered
how can i find the x Value
One option is linspace — x = linspace(-25, 25, 250); part1 = @(x) (x >= 5).*(10*sqrt(x) + 25); part2 = @(x) (x >= 0 & x <...

5 years ago | 0

Answered
Using a for loop to split a matrix by rows
No loops necessary — X = [1 2 3 11 5; 77 1 2 11 3; 1 2 3 4 5; 1 2 3 4 5; 1 11 3 4 5; 1 2 3 4 5] X11 = X(any(X==11,2),:) Xnot...

5 years ago | 0

Answered
How to plot nullclines with differential equations
Work-around — x = linspace(0, 30, size(nullX1,1)); % Use 'linspace' To Create Correct Length 'x' x1min = ...

5 years ago | 0

| accepted

Answered
Simplify the below equation
There are apparently unmatched parentheses. Correct that problem, then try this again — syms v1 y1 Eqn = 2.1894533792906461...

5 years ago | 0

| accepted

Answered
Plotting LTSpice bodeplot in Matlab
This is not the most elegant or efficient way to read and plot this, however it has the advantage of working, so I’m using it — ...

5 years ago | 0

| accepted

Answered
Average the every 40 rows from csv file until finish and save the data in new csv files
I have no idea what you want to do. If you want to take the mean of the 1 second blocks (and you have the Signal Ptocessing T...

5 years ago | 0

| accepted

Answered
How to solve simultaneous differential equations?
It is nonlinear, so it does not have a symbolic solution. Integrate it numerically instead — % Parameters mumax=0.2; Ks...

5 years ago | 0

| accepted

Answered
How to plot the difference between two plots (using shade)
LD1 = load('OBS[1].mat'); OBS = rmmissing(LD1.OBS); LD2 = load('Modeled[1].mat'); Modeled = rmmissing(LD2.Modeled); x ...

5 years ago | 1

| accepted

Answered
Find middle point between extrema and zero crosses
There is no specific function, however the code is relatively straightforward. The result depends on what your data actually ar...

5 years ago | 1

Answered
How to plot inverse laplace function
Since you’re obviously using the Symbolic Math Toolbox, use the fplot function. .

5 years ago | 0

| accepted

Answered
I'd like to plot thee variables from a state space which represents a DC motor.
I am not certain what you actually want to do. One option would be to use the lsim function and a suitable input and appropai...

5 years ago | 0

Load more