Respondida
Smooth a time serie not afectig max/minimun data?
See if the Signal Processing Toolbox envelope function will do what you want. Choose the 'peak' option, and experiment with the...

más de 2 años hace | 0

Respondida
How to reduce my sample rate of data
Use a colon-operator generated vector with the necessary step. Example — A = [1:50; randn(1,50)].' idx5 = 1:5:size(A,1) ...

más de 2 años hace | 1

Respondida
Extracting certain frequencies from FFT results using a window function
Frequency dokmain filtering is possible, however not ideal. If you want to do that, the fftfilt function is the best option. ...

más de 2 años hace | 0

Respondida
I need help with a code that uses a text file and its path to compare the data points to a sine wave that best fits the data
The data trace a straight line without any oscillations at all — T1 = readtable('Data18.txt') x = T1{:,1}; y = T1{:,2}; ...

más de 2 años hace | 0

Respondida
offset on y-axis
To plot them all on the same axes, you would need to offset them by some constant factor. x = linspace(350, 600).'; ...

más de 2 años hace | 0

| aceptada

Respondida
Can someone please explain what I’m doing wrong?
The semicolon in the legend call is wrong (in this context). It would be better to write all that as a script rather than in ...

más de 2 años hace | 0

| aceptada

Respondida
Can MATLAB read .txt like FORTRAN?
Yes. Use the fixedWidthImportOptions function to define the field widths, then use that in conjunction with readtable to read...

más de 2 años hace | 1

| aceptada

Respondida
when I open a script in MATLAB, it opens it in a new window instead of the main one. how do I change that?
I am not certain what you are referring to. In the upper right corner of the Editor, there is a white downward-pointing tira...

más de 2 años hace | 2

Respondida
Assigning values to the arguments of a function handle
Again, using numbered variables as not considered good programming practise. I believe this correspoinds to your original cod...

más de 2 años hace | 0

| aceptada

Respondida
I am using the symbolic tool box and have generated a number that has over 25,000 digits and would like to store that number in it's entirety onto a disk file.
One option would be to save it as a string array — syms x x = vpa(pi, 250) srt_x = string(x) whos You might want to s...

más de 2 años hace | 0

| aceptada

Respondida
How do I convert double to cellstr?
Use the compose function (introduced in R2016b) — A = [2 25 1017]; Ac = compose('%d',A) .

más de 2 años hace | 0

| aceptada

Respondida
Why do I get the error "Unrecognized function or variable"?
The important information is likely not shown here. My guess is that you are referring to ‘HW1’ somewhere else (perhaps in anot...

más de 2 años hace | 0

Respondida
Error with using fminsearch
Yoiu need to add the 'Vars' argument to your matlabFunction call— syms x y; % Peaks Funktion f = 3*(1-x)^2 * exp(-x^2-(y...

más de 2 años hace | 1

Respondida
Error using patch Value must be of numeric type and greater than 1.
I was not able to get these to work with patch (I still do not understand what that problem is), however with a minor modificat...

más de 2 años hace | 0

| aceptada

Respondida
Moving from an index in the matrix to an x,y value
Perhaps something like this — x = linspace(0, 10, 50); y = linspace(0, 10, 50); zm = exp(-(x-4.5).^2/4) .* exp(-(y(:)-4.5).^...

más de 2 años hace | 0

Respondida
whos - I can't capture the output
Perhaps something like this — A = magic(7); B = string(randi(9, 4)); C = sin(2*pi*(0:0.01:1)); whos S = whos; Fields ...

más de 2 años hace | 1

| aceptada

Respondida
Make a contourf plot beautifuller
The first one (with or without contour lines) is possible with a combination of the surf and view functions — [X,Y,Z] = peaks(...

más de 2 años hace | 1

| aceptada

Respondida
Implementing Hilbert Function to obtain envelope
The envelope function was introduced in R2015b. It makes these problems easier.

más de 2 años hace | 0

Respondida
Extracting data from text file after a specified word
The textscan function works well for these sorts of problems if the files have a consistent internal structure — contents = fi...

más de 2 años hace | 2

| aceptada

Respondida
Generate coordinates (3D), having the same contour as the initial circle but with a smaller size
One approach — nodes = importdata("plane_new_ok.mat"); center = importdata("node_new_ok.mat"); rf = scatteredInterpolant(n...

más de 2 años hace | 0

| aceptada

Respondida
How can I add two fft functions?
It is obvious from looking at the code that the fft results have different lengths, specifically 523 and 1046 elements in each. ...

más de 2 años hace | 1

Respondida
Where is the month, day and year string stored in a plot with a datetime axis which shows hours and minutes in the xticklabel string?
If you have R2023b, you can use the recently introduced xsecondarylabel function — t1 = datetime('2023-04-01 04:00:00'); t2...

más de 2 años hace | 0

| aceptada

Respondida
area in trapz coming out negative
‘... was wondering if I can just take the abolute value and if that would be bad data?’ If the descending values of the indep...

más de 2 años hace | 1

Respondida
Error using fopen for obj file
A returned value of -1 means that fopen can’t open the file. First, run: which fileIn to see if MATLAB can find it. If no...

más de 2 años hace | 1

| aceptada

Respondida
Problem with fitting a loglog plot
Using a linear regression on logarithmically-transformed data creates multiplicative errors, not additive errors that least squa...

más de 2 años hace | 0

Respondida
How to use symbolic equation?
For symbolic plots, use the fplot function — syms Wosc R C gm Ao = gm*R/(1+2*pi*Wosc*R*C); pretty(Ao) R = 1000; C = 27...

más de 2 años hace | 1

| aceptada

Respondida
Add a line on the graph
Try this — num_simulations = 10000; %Common parameters Discount_Rate_min = 0.06; % assume 6-8% Discount_Rate_max = 0....

más de 2 años hace | 2

| aceptada

Respondida
Combination of two tables with different time lines
Converting the times in the first file is straightforward. Everything else seems to be NaN. T1 = readtable('Combining1.xlsx'...

más de 2 años hace | 0

| aceptada

Respondida
How to solve the error for graph?
I tweaked your code a bit, however it is still incorrect. The main problem is that ‘avg_LCOH_SOEC’ should be a (24x24) matrix...

más de 2 años hace | 0

Respondida
Adding the stl file to the Matlab simulation
It depends what the .stl file is. The first step would be to use the stlread function to import it, and then use trisurf (or...

más de 2 años hace | 0

Cargar más