Answered
how to get my plot to only go to the value of 'n' I have set
The easiest way is to just use xlim — syms t; n = 0:20; N = 21; % piecewise of x1 and x2 for unit pulse x_n = [1, zeros(...

4 years ago | 0

Answered
How do I do the fourier transform of a data array?
Try this — % LD1 = load('ref_clean.mat'); % ref_clean = LD1.ref_clean; LD2 = load('data_clean.mat'); data_clean = LD2.data_...

4 years ago | 1

| accepted

Answered
Bug in islocalmin/islocalmax?
Those functions (and findpeaks) do not use anything that could be considered to be a ‘tolerance’. The ‘prominence’ of a peak (o...

4 years ago | 0

Answered
Area between the peak of the signal
I had to tweak the code slightly to get the result I needed for the ‘areav’ and ‘absareav’ calculations. Try this — % opts...

4 years ago | 0

| accepted

Answered
how to assemble a symbolic series?
Try something like this — b = randi([0 1], 1, 12) for k = 1:7 sb(k,:) = b(k:k+5); end sb bc = mat2cell(sb,ones(7,1),6...

4 years ago | 1

Answered
Undefined function periodgram for input arguments of type double?
It would be nice to know what ‘x’ is. If it is a table, the reference should be: x{:,1} (note the curly braces {}) instead...

4 years ago | 0

| accepted

Answered
How to solve an equation with one unknown and both sine and cosine
Try this — syms theta Eqn = 3.0179 == 6*cos(theta) - 2*sin(theta)*0.8660254038 theta = solve(Eqn, theta) thetav = vpa(thet...

4 years ago | 0

| accepted

Answered
Loading a .csv file that contains units
Try something like this — opts = detectImportOptions('CSV File Test 2022 06 17.txt'); opts = setvartype(opts, 'Var4','double'...

4 years ago | 0

Answered
Solve Equation and Plot it
The result ie not exactly the same as the plot in the original question, however it is close — alpha = 0.4207; skalar = 4.53...

4 years ago | 0

| accepted

Answered
How can I interpolate lines and colonnes
First, all four of those matrices would have to be entered separately. Second, use ndgrid to create the matrices from the nec...

4 years ago | 0

Answered
find first time 0 again after higher 0
One approach — M = [0 0 0 0.0619999999999550 0.108000000000004 0.129999999999995 0.156999999999982 0.176999999999964 0.1850000...

4 years ago | 0

| accepted

Answered
How to insert a zero column vector in a matrix according to a particular position?
Another approach — M = randn(4) % Original Matrix [rows,cols] = size(M); A = zero...

4 years ago | 0

Answered
Problem getting Matlab to plot data
Add: yAxisDataPwr = str2double(data{4:end,i}); to convert the character vectors to numerical values just before the plot call...

4 years ago | 1

| accepted

Answered
Change Width of line
The ‘I_BT’ value is missing. cycnr80 = interp1(Dk,(1:numel(Dk)),80) This should produce the cycle number where ‘Dk’ crosses ...

4 years ago | 0

Answered
Converting whole numbers to scientific notation
Another option — expstr = @(x) [x(:).*10.^ceil(-log10(abs(x(:)+(x==0)))) floor(log10(abs(x(:)+(x==0))))]; % Updated: 202...

4 years ago | 0

Answered
How to interpolate the local peak elevation to obtain the profile ?
One option is the envelope function. Choose the 'peak' option and an appropriate value for the window length.

4 years ago | 0

Answered
Intersection of two curves in matlab
The ‘I_BT’ variable is missing, so I cannot run the code. However getting the intersection of the exponential and the line is ...

4 years ago | 0

Answered
Interpolating each row of a matrix with NaN values
I am not certain that I understand the problem, however if the intent is to interpolate the NaN values, see if the fillmissing f...

4 years ago | 0

| accepted

Answered
Expected Shortfall for asset returns
If I understand correctly what you want to do, it would likely be easier to create ‘ind’ as a logical vector. There is also no ...

4 years ago | 0

| accepted

Answered
Make unit vectors at equal angles without for loop
Possibly — a = linspace(0, 2*pi, 7); r = 1; x = r*cos(a); y = r*sin(a); zv = zeros(size(a)); figure plot([zv; x], [zv;...

4 years ago | 0

Answered
How to draw the figure dot like this. ( I have a example figure.)
Try this — A = [30 45 60; 0.069491 0.135992 0.398871; 0.069491 0.135992 0.398871]+[0; 0; 0.3]; figure plot(A(1,:), A(2:3...

4 years ago | 0

| accepted

Answered
How can I make a 3D bar chart for a 1044X22 array which is colored with height?
I am not certain how clearly that sort of matrix can be defined Try this — Data = rand(1044,22); figure b = bar3(Data); ...

4 years ago | 0

| accepted

Answered
vpasolve gives answers outside the range that I specify
One option is to specify conditions on the variables, for example on ‘E’ (and any others you may want) — syms E C D V P S A a...

4 years ago | 0

Answered
How do I multiply two functions handles?
In the ‘D_i’ function, ‘c_i’ was originally missing its argument, and that threw the error. Correcting that, and vectorising ...

4 years ago | 1

| accepted

Answered
Visualy change values of legend
Possibly — x = [1:288]; y = rand(288,1); plot(x,y); xlabel('time in 5 min') ylabel('random numbers') title('24/5 over a...

4 years ago | 0

Answered
How to extract y-value data at a certain x-value?
The code is incomplete and cannot run as posted. Using the .fig file instead: F = openfig('Velocity against frequency for c...

4 years ago | 1

| accepted

Answered
How to plot 2 symbols with an equation that contains complex numbers
Two symbols (variables) will plot a surface, so use fsurf to view it — syms Bs Gs M(Bs,Gs) = (73968.9477018175*Gs^2 - (-0.00...

4 years ago | 0

| accepted

Answered
How to determine the reverse saturation current
I believe at least two multiplication operators are missing, after the ‘Na’ and‘Nd’ references: N_a=1.0*10^22; N_d=1.0*10^2...

4 years ago | 0

Answered
MATLAB function 'nearest' does not work.
The nearest function is used with graph or digraph objects. Apparently, you are using it with something else. Without knowin...

4 years ago | 0

Answered
Revolving a curve around the z- axis
The easiest way to do that would likely be to use the cylinder function — x = -10:0.01:10; y = -10:0.01:10; r=sqrt(x.^2+y.^2...

4 years ago | 0

Load more