Answered
Find and replace value in a table
Try something like this — Country = {'Australia';'Germany';'Canada';'United Kingdom';'France'}; Location = Country(randi(nu...

9 días ago | 0

Answered
Reshape to column vector
Transpose ‘a’ before calling reshape — a = [1 2 3 4 5 6 7 8 9 10 11 12]; b = r...

9 días ago | 0

Answered
How to make the axis labels of a plot BOLD
The axis lables and titles are text objects. Try something like this — x = 1:10; y = randn(size(x)); figure plot(x, y)...

9 días ago | 0

| accepted

Answered
Equation to exponential eq using curve fit tool.
It will produce the correct values if it is allowed to. The ‘b’ value is 100 times greater than it should be, according to the ...

10 días ago | 0

Answered
Why do I receive a subplot error?
That’s not how subplot works. It should be something like this — figure(1) hxl = subplot(2,2,1); scatter(height,leg) lsl...

10 días ago | 0

| accepted

Answered
How do I plot this Fourier series funcion?
I am not exactly certain what you want to do, however the loop is likely not necessary, sinc it is prefgerable to use MATLAB’s v...

10 días ago | 0

Answered
How to provide gaussian fitting of spectrums with multiple peaks ?
A version of that is actually provided in the findpeaks documentation (see Determine Peak Widths) and by getting all the outputs...

10 días ago | 0

| accepted

Answered
how to obtain single value answer from numeric expression
One option is the vpa function — syms x Ixx=int(x^4*sqrt(1+4*x^2),0,.5) Ixx = vpa(Ixx) .another one is double, depending on...

10 días ago | 0

Answered
Turning a product of two vectors into a matrix without using for loops?
I believe something like this should do what you want — x = 1:10 y = 11:20 M = x(:)*y Using ‘x’ as x(:) forces it to become...

10 días ago | 1

| accepted

Answered
saving matrix using fprintf in .txt file with different formatSpec
Try something like this — data=[2 0.232 0.333 0.421 0.111;3 0.111 0.252 0.385 0.600;4 0.500 0.620 0.100 0.210]; fid = 1; ...

10 días ago | 1

| accepted

Answered
How can I use generated time vector in the main program in subprogram ?
I do not understand the question you are asking. It is certainly possible to pass a time vector to a different function that ...

10 días ago | 0

Answered
Fitting a simple digital signal from noisy measurements (piecewise linear fitting?)
I cannot find a built-in function that incorporates a slew rate, so so programming it yourself would be necessary. One option...

11 días ago | 0

Answered
Why do I get NaNs when I try interpolating with interp1?
It will do that if you atempt to extrapolate without telling interp1 how you want to do it. Try this — interp_co2 = interp1...

11 días ago | 0

Answered
plot 3D grid using mesh() with lack of individual data
It would be best to have your data, however an illustration of the procedure using the fillmissing function is — . x = 1:11; ...

11 días ago | 1

| accepted

Answered
How to solve quadratic equation in x and y?
I am not certain what solve is in this context. Plotting the function is straightforward — syms x y f(x,y) = 3*x^2 - 6*...

11 días ago | 1

| accepted

Answered
Trying to get S(100) value several times
The value after 100 iterations of the ‘t’ loop will be the last value of ‘S’, so subscript it with the index of the outer loop t...

11 días ago | 0

Answered
how to import date with other variables from the XLX file.
I would use the readtable function — T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/760931/M...

11 días ago | 0

| accepted

Answered
HOW DO I USE AVERAGEIF(excel) IN MATLAB?
The groupsummary function is also an option — g = {'Male';'Female'}; allSamples = table(randi([60 99],20,1),randi([160 210],2...

11 días ago | 0

| accepted

Answered
calculating angle between line of best fit and x axis
The slope is simply the tangent, so — slope_angle = atand(p(1)) % Slope Angle (°) Here, tha...

11 días ago | 0

| accepted

Answered
Can someone tell how I should code this equation for plot
That would work (with multiplication operators) in the Symbolic Math Toolbox — syms t x(t)=0.8*cos(14*t) figure fplot(x,...

12 días ago | 1

| accepted

Answered
Lower and upper bounds in optimization technique
Create appropriate vectors for each bound. Specify the bounds for the parameters that have bounds, and +Inf and -Inf for those ...

12 días ago | 0

| accepted

Answered
How can I create a shaded plot like the figure sample shown here?
Try something like this, using patch — x = linspace(70, 130, 12); y = rand(2, numel(x)); figure plot(x, y) grid hold ...

12 días ago | 1

Answered
How to analyze different segments in a timetable?.
Try this — LD = load('timetable.mat'); AB001 = LD.AB001; ExptMarker = AB001.fTimeMark; % Marke...

12 días ago | 0

| accepted

Answered
Why do the y axes have different lengths although they have same limits?
I do not understand what change is desired. Apparently ‘BH-1’ and ‘BH-2’ display different sets of data, however all the axes...

12 días ago | 0

Answered
set Y-Axis to descending order without changing data
I am not certain what the code actually does. It seems to me that there are two options — set(gca, 'YDir','reverse') yt =...

12 días ago | 0

| accepted

Answered
i can't plot this function in matlab
The code is correct except for the plot arguments. In the plot, it is necessary to plot the real and imaginary parts aginst ‘t...

12 días ago | 0

Answered
Show the xticks in the view of 2D
The default tick direction is 'in', so the x-ticks are not visible in the second plot. Set TickDir to 'out' or 'both' to see ...

13 días ago | 0

| accepted

Answered
how to linear interpolate using a for loop
x = linspace(-50, 50, 250); y = x.^2 -2; zx = find(diff(sign(y))) for k = 1:numel(zx) idxrng = max(1,zx(k))-2 : mi...

13 días ago | 0

| accepted

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values.
To reference ‘Z’ as a matrix, ‘lat’ and ‘lon’ must be integers greater than 0, or logical values. The griddata function may b...

13 días ago | 0

Answered
Converting frequency domain to Time Domain using IFFT.
I made some assumptions and managed to invert the frequency-domain signal — T1 = readtable('https://www.mathworks.com/matlab...

13 días ago | 0

Load more