Réponse apportée
Customize the x-axis of hht plot
Putting 501 datetime x-ticks would be impossible to read, at least with this example. This creates all of them, nowever only us...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
How to plot two figures side by side in a same plot?
The subplot and tiledlayout calls appear to be interfering with each other. Commenting-out the tiledlayout calls produces thi...

plus de 2 ans il y a | 0

Réponse apportée
How to fit two equations to two data set simultaneously and with multiple fitting parameters?
The Symbolic MathToolbox is not the best option here. Try a numeric approach, such as this one — x = [100 63.1 39.8 25.1 15...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
help wtih plotting ode function
There are two problems: First, ‘x0’ is initially identically zero, and that creates an Inf result for the first value of ‘A’ a...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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) ...

plus de 2 ans il y a | 1

Réponse apportée
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. ...

plus de 2 ans il y a | 0

Réponse apportée
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}; ...

plus de 2 ans il y a | 0

Réponse apportée
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).'; ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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 ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 2

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

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

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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).^...

plus de 2 ans il y a | 0

Réponse apportée
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 ...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
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(...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Implementing Hilbert Function to obtain envelope
The envelope function was introduced in R2015b. It makes these problems easier.

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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. ...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

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

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Charger plus