Answered
Convert Nan to zero in fplot
To plot the first value as 0, the most effective and efficient way to do what you want is to add a very small value (such as eps...

5 years ago | 1

Answered
How to extract all rows that only one columns has a value greater than?
One approach — T1 = array2table(randi(60,15, 7)) idx = any(T1{:,:}>50,2); % Logical Row ...

5 years ago | 0

| accepted

Answered
contourf doesn't plot left side of the figure in log scale!
The problem is the resolution in the ‘force’ vector. For example, check the increments — format long f1 = mean(diff(linspa...

5 years ago | 1

| accepted

Answered
PLotting a graph of third order differential equation
The initial conditions are not provided, and it is not possible to plot a function with symbolic (or otherwise undefined) parame...

5 years ago | 1

| accepted

Answered
How to change the direction of x axis.
Reversing the axis direction reverses the plot as well. I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_...

5 years ago | 1

| accepted

Answered
How can I plot a 2D graph with the Z value in color?
Try this — x = linspace(0,1); y = 2*(0:2)'+sin((1:3)'*2*pi*x); y(3,end) = NaN; figure plot(x, y(1:2,:)) hold on patch(...

5 years ago | 1

Answered
How can I plot out the derivatives here?
Either plot the differential equation using the solved values for ‘t’, and the solved values for the integrated variables, and o...

5 years ago | 0

Answered
Linear Regression gives NaN
There are 8 NaN values in those variables. Eliminate them and it works — T1 = readtable('https://www.mathworks.com/matlabce...

5 years ago | 0

| accepted

Answered
where could my error
I bellieve ‘NumSamples’ should be larger. Try this — Fs = 5000; % <- A...

5 years ago | 1

Answered
How to shorten the amount of decimals?
Use the digits function.

5 years ago | 0

| accepted

Answered
How do find the peaks of pulses from an array
It would be helpful to have a sample of the data. Two options: findpeaks and islocalmax.

5 years ago | 0

| accepted

Answered
How do I plot this as a unit step response
If you just want to plot it, the eassiest way is first to code it correctly, then use fplot. syms t C(t) = 0.5*(1 - exp(-2*...

5 years ago | 0

| accepted

Answered
30-day running running mean to the detrended timeseries
This requires reading it as a table, converting it to a timetable and then use the retime function — T1 = readtable('https://w...

5 years ago | 0

| accepted

Answered
Modelling of prediction equation
Yes. Combine the first three variables into a single matrix, then rever to them by columns. The procedure would go somethi...

5 years ago | 1

Answered
Importing table and making a stacked plot with same x and y axis
There are some non-finite values in ‘tbl3’ that made this interesting. This approach interpolates all the data in the three t...

5 years ago | 1

| accepted

Answered
Help! Graph shows nothing when I run my system of differential equations code.
The plot call is in the wrong place in the code. It should be after the ode45 call. The good news is that it’s growing like...

5 years ago | 1

| accepted

Answered
How do I get the x y coordinates from an index?
My best guess as to what you want — A =[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]; index = 4; [r,c] = ind2sub(siz...

5 years ago | 1

| accepted

Answered
visualization of huge matrix
See if the spy function will do what you want. Its purpose is to visualise sparse matrices, however it could work with yours ...

5 years ago | 1

Answered
Solve equation for one unknown with one known parameter
Try something like this — a=0.5; % x=linspace(-2*a,2*a,100) x=linspace(-2*a,2*a,20); eqn=@(x,y,a)(1/2*a^2)*[x^2./(2-(1-(x./...

5 years ago | 0

| accepted

Answered
Ploting graph on matlab
The function declines very rapidly, so use a different value for ‘t’ — % t = 0:1:100000; t = linspace(0, 2E-3, 500); ic = -...

5 years ago | 1

| accepted

Answered
plot x-axis data with discretize
Perhaps something like this — x = 0:2:24; y= rand(1,13); plot(x,y) xticks(0:2:24) % 'xtick...

5 years ago | 0

| accepted

Answered
Extracting data from .mat file
Use the load function, and specifically, Load List of Variables into Structure Array. The structure array then allows selection...

5 years ago | 0

| accepted

Answered
How to evaluate frequency response of a filter using freqz()?
This is not correct: [h,w] = freqz(b,a); %here, b is the impulse response vector and a is 1 plot(h, abs(w)); It shouild be: ...

5 years ago | 0

Answered
how to generate below sawtooth pulse
Another approach using a logical threshold (specific to this waveform) — t = linspace(0, 7, 500); s = rem(t,2); s = s.*(s<1)...

5 years ago | 0

Answered
Matlab issues with plotting a variable
There are gaps in the ‘Base Speed’ variable, so these need to be detected and the corresponding rows of ‘Cores’ eliminated in or...

5 years ago | 0

| accepted

Answered
Perform inverse weighted least squares regression
‘Would this be 1/error of each point?’ That would appear to be a reasonable approach, since the data with the smallest errors...

5 years ago | 0

| accepted

Answered
Finding the frequency and the phase shift of a Sin signal
One option is described in Curve fitting to a sinusoidal function and a version that could be more appropriate to your problem ...

5 years ago | 1

| accepted

Answered
Find all possible ordered pairs that satisfy a linear equation
The ‘all possible’ criterion would produce infinite solutions. I suspect you would spend the rest of your life calculationg it!...

5 years ago | 0

Answered
cell2table is not recognizing certain columns (not all) containing double data
I am not certain what the problem is with readcell, however unless it is absolutely necessary to use it, use readtable instead, ...

5 years ago | 0

Answered
Simulation of drug distribution with ordinary differential equation
The syntax was not passing the parameters correctly to ‘ode_ex’, and was not passing to correct arguments, at least from what I ...

5 years ago | 0

| accepted

Load more