Answered
How to find and chart the frequency of a letter in column with histogram.
Perhaps — Col = {'HFHFHSHHAJHJA'; 'HSAJHFGFSAGJ'; 'HSGHSFFJHJ'}; T = cell2table(Col) RowSum = cellfun(@(x)sum(x=='H',2),T{:,...

5 years ago | 0

Answered
Error with find(X) statement
Taking a wild guess, since the test is: states=find(sum(UNITARY_MATRIX)~=1.0) it is likely encountering floating-point approx...

5 years ago | 0

| accepted

Answered
vector gives 0 integral
There quite definitely is! In your call to it: sd = trapz((z),0,20) the function interprets ‘z’ (the parentheses aren’t n...

5 years ago | 0

| accepted

Answered
How to shade/color overlapped area in the graph?
I honestly have no desire to download ‘plotxx’ and learn its intricacies, so I used yyaxis instead here. The same approach sh...

5 years ago | 2

| accepted

Answered
Create line between plot points
Yes. x = [0 10 20 30]; y = [355 433 510 590]; figure plot(x, y, '*-r') grid Ax = gca; Ax.XMinorGrid = 'on'; Ax.YMino...

5 years ago | 0

| accepted

Answered
plotting a phase plane with a system of linear diff equations.
Using the numeric ODE solvers, likely the easiest way to do that is to use odeset to set options, and then choose 'OutputFcn', @...

5 years ago | 0

| accepted

Answered
Why am I getting a Parse error for a sequence?
It’s missing an equal (=) sign: for it = 1:MaxIt %this starts 'for' loop and runs for MaxIt times. .

5 years ago | 1

Answered
Is there any way to do LFIT (general linear least-squares fit ) on the time series data using MATLAB?
That depends entirely on what you want to do. One approach: syms a b c d e f g t y = a + b*t + c*t^2 + d*sin(2*pi*t) + e*...

5 years ago | 0

Answered
Problem with reshape and Surf plot
The only solution I can propose is to use either griddata or scatteredInterpolant . Try this — opts = detectImportOptions('...

5 years ago | 0

| accepted

Answered
how to sort table by row sub-string values?
Try this — wellname = {'01A58' rand; '01A59' rand; '01A62' rand; '01A63' rand; '01A66' rand; '01A58' rand; '01A59' rand} well...

5 years ago | 0

| accepted

Answered
What is the frequency of my signal?
Try this — LD = load('Frequency.mat'); t = LD.t; CH0 = LD.CH0; Fs = 0.1; ...

5 years ago | 1

| accepted

Answered
how to do average over third dimension?
Taking a slightly shorter example, try something like this — % ucom = randi(9,21,41,24); ucom = randi(9, 3, 4, 24); sz_ucom ...

5 years ago | 0

| accepted

Answered
How to pre-allocate my loop for speed?
I am not certain what the problem is, however the preallocation would be straightforward: pk_seagrass = NaN(1,length(ping_time...

5 years ago | 1

| accepted

Answered
Find energy for each second of audio file
Use the buffer function: Fs = 44.1E+3; % Sampling Frequency s = randn(Fs*5.2,1); ...

5 years ago | 0

| accepted

Answered
Does anyone know why the second plot doesn't work?
Yes! In line #44, there is a hold off call, although no new figure call, so the subsequent plot overplots the existing plo...

5 years ago | 0

| accepted

Answered
function interpolation and root finding
Try this — points = [0.500000000000000 0.500000000000000 0.498097349045873 0.494452298903742 0.49...

5 years ago | 1

| accepted

Answered
Please someone help test run this Matlab code and debug it if possible. Please help a student
The ‘uexact’ variable does not exist, and there is nothing similar to it (for example by a different spelling, at least that I c...

5 years ago | 0

| accepted

Answered
How to solve damped forced vibration analysis using ode45 ?
One problem is with the ‘dxdt’ assignment. MATLAB interprets the spaces as delimiters, so the second row has 3 columns, as MATL...

5 years ago | 0

| accepted

Answered
Does anyone know how to add the legend?
I am not exactly sure what you want. First, the clear all and close all calls are not necessary and make your code less effic...

5 years ago | 0

| accepted

Answered
Write a complex number in polar form
The ‘image below’ is slightly difficult to read, however the code to do that is easy to write. This is called phasor notation. ...

5 years ago | 0

| accepted

Answered
How To Extract Data from Multiple CSV Files and Run Analysis?
Try something like this — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/693589/data1.csv') T...

5 years ago | 0

Answered
How can I plot a trendline that follows the peaks a time-history data set (accelerogram)?
The envelope function could do what you want. Another option is findpeaks, with the appropriate name-value pair arguments. ...

5 years ago | 0

Answered
Detect signal clipping and remove
Without an example signal, I am guessing that the ‘clipped’ or ‘railed’ parts of the sound would be equal to ±1, with the valid ...

5 years ago | 0

Answered
How to calculate the standard error estimation when using fit from curve fitting toolbox?
Yes. Use the predint function. x = linspace(0, 100, 100); y = -0.3*x + 2*randn(1,100); [f,gof,out] = fit(x(:), y(:), ...

5 years ago | 0

| accepted

Answered
Create a graph from 2 vectors and a matrix
I would use surf or mesh: figure surf(X,Y,Z.', 'EdgeColor','none') to see it from the top, add: view(0,90) ,

5 years ago | 0

Answered
How to get wrapped phase data from unwrapped phase data
According to the unwrap documentation, unwrapping takes the original and adds radians to phase angles that originally go from ....

5 years ago | 0

| accepted

Answered
the findpeaks function does not seem to work for me
The findpeaks function is in the Signal Processing Toolbox. You will have to have it licensed and installed to use the function...

5 years ago | 0

| accepted

Answered
How to conditionally merge multiple variables in a table
Concatenate them horizontally uising square brackets [], then assign the name to the new variable — var_a = [1:10]'; var_b = ...

5 years ago | 1

Answered
Display an Error Message
The code works. The if logic is the opposite of what you indicated that you want. Correcting that (and a couple other small ...

5 years ago | 0

| accepted

Answered
How can I convert the serial date numbers in a text file to calendar dates
It appears to be a MATLAB date number, and if so, maps to 1 Jan 1979 10:00:00 — DT = datetime(722816.416666667, 'ConvertFrom',...

5 years ago | 0

Load more