Answered
convert date to number
This appears to do what you want: This = '00:01:36.480'; NowThis = datetime(This, 'InputFormat','HH:mm:ss.SSS', 'Format','HHm...

6 years ago | 0

Answered
Reading Text file with headers
Another approach: txt = fileread('X.txt'); timepos = strfind(txt,'Time:'); endpos = strfind(txt, 'end'); for k = 1:numel(ti...

6 years ago | 0

| accepted

Answered
Importing multiple .odt files with specific row and column ranges into Matlab.
If you have R2019a or later, see if the readmatrix function will read it. Then see: Import or Export a Sequence of Files.

6 years ago | 0

Answered
Bode plot of the following equation
Perhaps: s=tf('s'); U=(8+22/s+32*s); [m,p,w] = bode(U); figure subplot(2,1,1) plot(w, 20*log10(squeeze(m).^0.2)) yla...

6 years ago | 0

Answered
Why fft dosen't conserve energy?
From the fft documentation: Y = fft(X,n) returns the n-point DFT. If no value is specified, Y is the same size as X. If X is ...

6 years ago | 0

| accepted

Answered
Create two surfaces given two equations and four unknowns
There ar an infinity of solutions, so the symbolic solution will return no solutions. If you want to experiment with numeric ...

6 years ago | 0

Answered
To find the FWHM and area of pulses in a signal waveform
Try this: M = readmatrix('z_data.xlsx'); t = M(:,1); A = M(:,2); As = smoothdata(A, 'movmean',15); ...

6 years ago | 0

| accepted

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
The problem is that the first element of ‘Xs’: 4501354550746679/8796093022208 == 0 is not a function of ‘F2’, so it returns a...

6 years ago | 1

| accepted

Answered
Save an array with multiple rows and columns in .txt file
I would use the writematrix function (R2019a and later). Another option is dlmwrite (and its friends) if you do not have writem...

6 years ago | 1

| accepted

Answered
How to autosave matlab ode sover results if power goes
I would create a ‘tspan’ vector using linspace, then in a loop, integrate over a portion of the vector, save the results to a .m...

6 years ago | 0

Answered
Can't plot one-column stacked graph
It is only possible to plot two stacked bars. Hiowever, after that, it is possible to turn one of them off. Try this: figu...

6 years ago | 0

| accepted

Answered
How to combine two outputs of a into a single vector.
I am not certain what result you want. Try this: L = randi([2,5]); lo = [1,5,10]; hi = [3,8,9]; for k = 1:length(hi) ...

6 years ago | 0

| accepted

Answered
Why is this not working
First, it appears that you are trying to solve it inside the functions, and that won’t work. Second, this: F(9) = 0.01*x(6)...

6 years ago | 1

| accepted

Answered
How do I find my computer's host id?
In Windows, it is the volume serial number for the C:\ drive. To get it, run this from a script or the MATLAB Command Window:...

6 years ago | 1

Answered
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 0-by-1.
The problem is that vpasolve could not find a solution, so it returned an empty vector. The Symbolic Math Toolbox is good for m...

6 years ago | 0

| accepted

Answered
For loop overwrites values in signal
First, please do not use ‘max’ as a variable name. It is the name of the max function (obviously) and variable names take prece...

6 years ago | 0

| accepted

Answered
how to create equation x y z using matlab
If you simply want to plot them: x = [5.252907987, 1.945397314, 1.016, 0.243]; y = [287.4171875, 137.4367188, 80.08359375, 37...

6 years ago | 0

| accepted

Answered
how to find the values of x,y, z,t
Try this (after adding the necesary multiplication operators): syms t x y z F = [0.542294 + 1.2144*x + 1.025*y + 0.0666*x^2...

6 years ago | 0

Answered
TRANSER FUNCTION OF RC CIRCUIT WITH GIVEN VALUES
I would use a for loop to change the component values and plot them. The instructions say to use the same set of axes (use the ...

6 years ago | 0

Answered
Input argument in a function as a string?
It’s a bit more involved than that. The axis labels and the title are Axes Properties, not Line properties, so: ax.XLabel.S...

6 years ago | 0

| accepted

Answered
How to convert accelerometer data from excel into frequency
The sampling frequency is too low to detect a 130 Hz vibration: A = readmatrix('DutyCylce82Vals2.csv'); A(:,1) = A(:,1)*1E-3;...

6 years ago | 0

| accepted

Answered
Read CSV with row in quotes (string and numbers)
‘I have no idea to read the .CSV file correctly.’ One approach: C = {"7129300520,""20141013T000000"",221900,3,1,1180,5650,"...

6 years ago | 0

| accepted

Answered
What factors I need to consider when transferring to new version of Maltab?
The 2020a is pre-release, so you cannot discuss any details of it here. For all the others (including 2020a when it is releas...

6 years ago | 1

Answered
Create function handle from function file
Yes! In some instances, that is necessary in order to evaluate the function. Example — function y = f(x) y ...

6 years ago | 0

| accepted

Answered
function variables not saved to workspace
Call the function as: [x,y]=myfunc() and both should be in your workspace.

6 years ago | 2

| accepted

Answered
How to extract values from an array?
The default ‘step’ for the colon operator is 1. So ‘val1’ correctly addresses elements 1 through 4. Since ‘x’ has values fro...

6 years ago | 0

Answered
Matlab on Windows XP?
The last release I can find that supported Win XP was R2014b. These are the requirements for R2019b.

6 years ago | 0

| accepted

Answered
Damped harmonic oscillator fitting
The exponential ddecay is likely multi-exponential, since a single expoinential provides a decent although inexact fit: D = lo...

6 years ago | 1

| accepted

Answered
How to numerically integrate a vector over time?
If you want the cumulative integral of your vector, use the cumtrapz function.

6 years ago | 0

Answered
Multiplying an entire table by a column from another table.
Use the varfun function. Example — T = array2table(randi(99, 7, 5)); V = randi(99, 7, 1); TV = varfun(@(x)x.*V, T);

6 years ago | 0

| accepted

Load more