답변 있음
Reshaping Structure in every iteration
V = []; for i = 1:10 V = cat(1, V, rand(5 + 10 * (i - 1), 1)); M(i).position = V ; end

4년 초과 전 | 1

답변 있음
Is it possible to improve the performance of my script?
Some hints: Avoid global variables, because they impede the debugging massively. If a code grows (e.g. over 20'000 lines of cod...

4년 초과 전 | 0

답변 있음
How to generate random packets of fixed size for modulation?(e.g. I want to set the size of my packets to 1440 bytes using randi(imax, s1, s2)?
I'm not sure what you are asking for. Maybe this helps: % 1440 random bytes: data = randi([0, 255], 1, 1440, 'UINT8');

4년 초과 전 | 0

답변 있음
437.49999999999999999999999032463 / 0.99999999999999999999999999999999 Rounds out
Again: Matlab stores floating point values in IEEE754 format. This is the standard format used in CPUs also. Variables of type ...

4년 초과 전 | 2

답변 있음
error vectors must be of same length?!
A bold guess: E = abs(((xold - x) ./ x) * 100); % ^ insert this . for elementwise division ?!?

4년 초과 전 | 0

답변 있음
problem with matrix dimension
How are input and output related? Maybe one of this methods do, what you need: x = rand(51, 500); y1 = x(:, 1:80); ...

4년 초과 전 | 0

답변 있음
Unable to import .csv file
The message is clear: "Unable to find or open 'Rho_ISA.csv'" This means, that this file is not found in the current folder. So ...

4년 초과 전 | 0

| 수락됨

답변 있음
Create calibration checkerboard using built-in function
nX = 5; % Number of columns nY = 4; % Number of rows C = zeros(nY, nX); C(1:2:nY, 1:2:nX) = 1; C(2:2:nY, 2:2:nX) = 1; im...

4년 초과 전 | 0

답변 있음
Convert file with negative value and nan to double
importdata is extremely smart.Try this: S = fileread('Au_1_E_chem_experiment_SPR_angle_offset_after_PEG.dat'); S = strrep(S, '...

4년 초과 전 | 1

| 수락됨

답변 있음
game of life count matlab neighbor name
mod(a,b) replies 0 when the value is wrapped. 0 is no valid index in Matlab. So use instead: mod(a - 1, b) + 1 By the way, the...

4년 초과 전 | 0

답변 있음
How to fix " ''Value' must be a double scalar within the range of 'Limits'
Use the debugger to examine the problem: dbstop if error Run the code again until Matlab stops at the error. Now check the val...

4년 초과 전 | 0

답변 있음
What is this Number? 31.006276680299820175476315067101
Matlab uses IEEE754 doubles to store numbers. They have about 15 valid digits. You provide many more digitis in your input, but ...

4년 초과 전 | 1

| 수락됨

답변 있음
Hello everyone, could you kindly translate and explain the command I am writing below into words?
XM(2:end) > 126.5 & XM(1:end-1) < 126.5 % A This replies a logical vector, which is TRUE, if the value on the left side is ...

4년 초과 전 | 0

| 수락됨

답변 있음
Delete the same numbers appeared in different rows
Are the rows unique? If so, just join all rows to one vector: X = [5 14 9 6 7 8; ... 1 10 6 2 3 4; ... 14 23 18 15 ...

4년 초과 전 | 0

| 수락됨

답변 있음
solving Tuned Mass Damper using ODE45, need help putting in equation as parameter to solve
As far as I can see, you have everything you need already. [t,x] = ode45(@(t,x) A * x + [0; 0; sin(om*t); 0], tvec, x0); If ...

4년 초과 전 | 1

| 수락됨

답변 있음
How to plot multiple lines from a for loop iteration?
You do create a lot of plots, but all have the same value so they conceal eachother. A small change to demonstrate this: R = 2...

4년 초과 전 | 0

답변 있음
Center-justifying sprintf() values in a uitable
See: https://www.mathworks.com/help/matlab/ref/uistyle.html#mw_835eaae9-b0c6-4aa9-b8c6-2ff5cf761137 https://www.mathworks.com...

4년 초과 전 | 0

| 수락됨

답변 있음
rename files using MATLAB
This cannot work: filePattern = fullfile(myFolder, '/time%3.3d/slice%3.3dtime%3.3d.png'); theFiles = dir(filePattern); The f...

4년 초과 전 | 0

답변 있음
Why does my graph come out wrong?
fplot(@(x) ((x.^2)-1).^(2/3))

4년 초과 전 | 0

답변 있음
BUTTER function returning slightly different results for Signal Processing Toolbox in R2020b and R2021a on same computer (Win10)
You can compare both results with this cheap implementation of a high pass Butterworth filter: format long g [num, den] = bu...

4년 초과 전 | 0

답변 있음
My implemetation for Newton's method doesn't seem to be working
I've cleanup the code, e.g. removed the not needed "x_old". Avoid using the names of important Matlab functions as variables: ep...

4년 초과 전 | 0

| 수락됨

답변 있음
Get plot lines title in a GUI plot by mouse click on each line
You can define a ButtonDownFcn for the lines: LineH(1) = plot(1:10, rand(1, 10), 'r', 'DisplayName', 'Line 1'); LineH(2) = plo...

4년 초과 전 | 0

| 수락됨

답변 있음
Error on using ODE45 and cannot prompt output
I get a different error message, which is very clear: k=1e9; r = 4.31e-3; kt=0.9; D=1; timespan=[0 30]'; C0=40000; first=...

4년 초과 전 | 0

답변 있음
Looping over an array using Fibonacci numbers as a range to calculate the mean
What should happen with the last chunk, if you cannot find enough elements in the input data? Should the 1st term really be: me...

4년 초과 전 | 0

| 수락됨

답변 있음
Complexity comparison: remove a key-value pair from a containers.map vs removing an item from an array.
You can run a short test: function [] = MapTest figure; len = 1e3:5e4:1e6; tMap = zeros(1, numel(len)); for idx = 1:nu...

4년 초과 전 | 1

답변 있음
How can I obtain the T and Y for R Runge Kutta method?
Store the first version starting with "function R=rk4(f,a,b,ya,M)" in a file called "rk4.m" and save it to a folder, which is i...

4년 초과 전 | 0

| 수락됨

답변 있음
Gurobi mex file cannot be found despite it being clearly there
Use the Dependency Walker to find out, which library is missing: https://www.mathworks.com/matlabcentral/answers/95906-how-do-i...

4년 초과 전 | 0

답변 있음
find the equal values that stand together on the same row or column or diagonal in the matrix
Maybe you mean: pool = [-1, 1, 2]; index = randi([1, 3], 15, 15); data = pool(index); match = conv2(data > 0, ones(3, 3)...

4년 초과 전 | 1

답변 있음
Index in position 2 exceeds array bounds (must not exceed 1).
dx1dt = x4 .* cos(x5) .* cos(u3); % Now dx1dt is a scalar ... x(1,i) = x(1,i-1) + h * dx1dt(1,i-1); % This treats dx1dt ...

4년 초과 전 | 0

| 수락됨

답변 있음
Storing values from a for loop
B = 1000; R2 = zeros(1, B); % Pre-allocation for iter = 1:B ... R2(iter) = 1 - sse / sst; end A problem is, that R...

4년 초과 전 | 0

더 보기