Answered
Reading dates/times from a text file
That is not a straightforward as it would fitst appear. Try this — Time = '20210824_UTC_06:47:41' DT = datetime(Time, 'I...

5 years ago | 0

Answered
Highlighting different part of graph
The likely solution is to add an independent variable vector: x = 0:numel(signal)-1; % Independen...

5 years ago | 0

Answered
How can a differential equation be solved, if its constants are in a system of equation relation?
It is difficult to follow the posted code, so I am not certain what you are doing. If you want to pass those variables to ‘di...

5 years ago | 0

Answered
how to swap some vector value?
Use the reshape and circshift functions: S=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] Sr = reshape(S,10,[]) Src ...

5 years ago | 1

Answered
Error in axis range
The axis call should go after the plot call: Jmax = 5; Tmax = 2; J = 0:Jmax; CT = rand(size(J)); CQ = rand(size(J)); CP =...

5 years ago | 1

Answered
FFT x-axis from samples to frequency
Try this instead — Y = fft(output,NFFT)/numel(output); F = (FS/2)*(0:NFFT/2-1); % Convert x-axis samples to Frequency S...

5 years ago | 0

Answered
ODE45 returns NaN values.
Adding: % Qt = [t>=min(t_array) t<=max(t_array)] to the ‘beam_function’ code demonstrates the problem. The ‘t’ value is alwa...

5 years ago | 0

| accepted

Answered
How to patch upperbound and lowerbound
Try something like this — T = table(datetime('now')+days(1:14).', rand(14,1), rand (14,1)+1, 'VariableNames',{'date','lowerbou...

5 years ago | 0

| accepted

Answered
How to solve this equation?
One approach — syms h(t) t Y Dh = diff(h); Eqn = 25*pi*Dh == pi*(4*0.0254)^2 * sqrt(2*9.8*h*2*(101325/876)+Dh^2)+90/3600 E...

5 years ago | 0

| accepted

Answered
Why am I getting "The value assigned to variable 'valid' might be unused"?
I did not run the code, however the second-to-last line assigns ‘valid’ as false: else disp('enter positive integers'), valid ...

5 years ago | 0

Answered
How can I find the Y value on an X–Y plot that corresponds to the tangent of the flattest part of a curve?
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/718334/exampleData.txt') T1 = rmmissing(T1); ...

5 years ago | 0

| accepted

Answered
Cannot use any trigonometric functions
‘Execution of script sin as a function is not supported:’ You have a script (not a functions) named ‘sin.m’. Rename it to ...

5 years ago | 0

Answered
Dry electrode Raw Ecg Signal Processing
Without knowing the experimental set-up, it’s not possible to say. A pair of electrodes connected to an amplifier are prone to ...

5 years ago | 0

Answered
Pulsewidth command giving empty column vector
It would be nice to see the waveforms that give values and those that do not. I suspect the reason is that the ones that do n...

5 years ago | 0

| accepted

Answered
Operands to the logical and (&&) and or (||) operators must be convertible to logical scalar values. What is my mistake ?
If thie posted code is in a loop and ‘sales’ is a scalar at each iteration, that error would likely not be thrown. salesv = r...

5 years ago | 0

Answered
Please someone should help me debug my error. The approximate solution is supposed to converge to the exact solution. I think i have problem with the code.
There are several typographical errors, at lelast with respect to the code representing the symbolic equations in the image. ...

5 years ago | 0

| accepted

Answered
Finding coordinates in a plot
I hope this is not homework! x = linspace(-5000, 5000, 250); y = [7.5; 1.9; 0.9] .* exp(-(0.001*[1; 0.85; 0.6] * x).^2); [y...

5 years ago | 0

| accepted

Answered
Is there a way to add error bars and standard deviations to a line plot figure?
Calculate the standard deviations using the std function, then plot the erroir bars with the errorbar function. .

5 years ago | 1

| accepted

Answered
How do I take the numerical solution of a system of ODEs and use that as a parameter in another system of ODEs?
The description of what you want to do is a bit ambiguous. The ‘pendulum’ solution is a (Nx2) matrix for ‘y’ with an associat...

5 years ago | 0

| accepted

Answered
Too many input arguments while solving BVP using bvp4c
The problem with ‘bvp_RHS’ was actually not with it, but with the extra argument to bvpinit. Eliminating that then produced the...

5 years ago | 0

| accepted

Answered
How to integrate linear system of vectorial equations?
syms kappa n(s) r(s) s t(s) r0 t0 n0 Y Eqn = [diff(r) == t; diff(t) == -r + kappa*n; diff(n) == -kappa*t]; rtn = dsolve(...

5 years ago | 0

| accepted

Answered
How to plot the surface of multiple data sets ?
It would help to have the actual data. N = 20; X = (0:N-1); Y = [1:3].'+zeros(size(X)); porous_upper = rand(20,3)+[0:2]; ...

5 years ago | 1

| accepted

Answered
Plot connected vertical points with different marks
Try something like this — x=[ 1 2 3 4]; M = rand(3,4); Mx = max(M); Mn = min(M); figure plot(x, Mx, 'd') hold on pl...

5 years ago | 1

| accepted

Answered
how replace dirac to diracz when need ?
I am not certain what you want to do. Since the independent variable may never exactly be 10.5, I drew that separately (‘i’ i...

5 years ago | 0

Answered
How do you evaluate the resultant function on int in time?
If you only need to code it and plot it, one approach would be to use the Symbolic Math Toolbox int and fplot functions. .

5 years ago | 0

Answered
Why is my code not plotting anything?
It is necessary to save the script as a .m file first, and the MATLAB Editor should have popped up the Save As window when you p...

5 years ago | 0

Answered
highlight different data on the same graph
Try something like this: Tclean = table(datetime('2021-07-21 00:00:00')+minutes(0:10:1000).', 'VariableNames',{'Time'}); % C...

5 years ago | 1

Answered
Question regarding the smooth filter function when using the Savitzky-Golay method
From the documentation: ‘... a fixed window length that is determined heuristically’ This can be returned as the second o...

5 years ago | 1

Answered
How I can run two different functions at the same time ?
I am not certain what you want, however one approach is to write a third function that returns all the outputs of the other func...

5 years ago | 0

| accepted

Answered
How do I randomly extract 20 segments of data from a signal?
If I understand correctrly what you want to do, this could work: signal = randn(60001,4) random_indices = randperm(size(signa...

5 years ago | 0

| accepted

Load more