Beantwortet
Generating 60 random samples that sum to 1, each subject to a unique lower and upper limit
Isn't this a job for: https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum ? % [x,v] = randf...

mehr als 3 Jahre vor | 0

Beantwortet
checking if field values in a single struct are identical
Depending on how the inputs look exactly, maybe: FieldC = struct2cell(S); Eq = true; for k = 2:numel(FieldC) if ~isequal...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Trying to extract data trail by trail, but my data is sampled at different sampling rate.
If one signal is measured with 1000 Hz and another with 2000 Hz, it is trivial to determine timepoints of the first one in the t...

mehr als 3 Jahre vor | 0

Beantwortet
How not repeat the main loop, if other options are selected?
The description is not really clear. I assume, you want a list of menus to be selected one after the other. Then: status = 0; ...

mehr als 3 Jahre vor | 0

Beantwortet
How can I generate the Radom number between two set of floating point number?
Gain0 = 0.0000250002787160545; Bias0 = -0.124315307973192; Gain = Gain0 + Gain0 * 0.18 * (rand(1, 160) - 0.5); Bias = Bias0...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How do I properly convert a 64-bit binary string / Convert directly from bin or hex to uint64
The question explains with many details, where the numbers are coming from. It would be more useful to post a set aof available ...

mehr als 3 Jahre vor | 0

Beantwortet
Fast computation of entries of large matrix
n = 2500; x1=rand(n, 5); % some matrix with high number of rows and small number of columns > 1 x2=rand(n, 5); % anoth...

mehr als 3 Jahre vor | 0

Beantwortet
2nd order euler method problem
You have to convert the 2nd order equation to a system of order 1 at first. Accumulating dx2/dt2 is not meaingful. The 2nd deri...

mehr als 3 Jahre vor | 0

Beantwortet
I tried dragging an image into the edit box for an answer on Matlab Central and doing so destroyed my answer.
Yes, I can confirm this behavior. For Firefox/Windows: When I drag an image into the field for editing (or anywhere else on th...

mehr als 3 Jahre vor | 0

Beantwortet
Renaming multiple files in a folder
Folder = 'C:\Your\Folder'; FileList = dir(fullfile(Folder), 'Antenna_REF_*.s2p'); for k = 1:numel(FileList) oldName = Fi...

mehr als 3 Jahre vor | 1

Beantwortet
How to vectorize nested loops with conditional statements?
tributary = randn([81, 126]); cp_mesh = randn([81, 126, 49792]); tic cp_B1_2 = zeros(49792, 1); for i = 1:4979 % 49792 ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
what does this error mean and how to fix it the image i imported was rgb and this error popped ,when its gray it works fine
imshow can handle RGB images as [M x N x 3] arrays and gray scale images as [M x N] matrices. The latter can be a logical matrix...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
memoize => Save/Restore Cache
There is no documented way to store the cache. But it is cheap to create a look-up table for your function and store it manually...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Select only the matrices within the cell
C = {rand(2), [], rand(3), [], [], rand(4)}; newC = C(~cellfun('isempty', C))

mehr als 3 Jahre vor | 0

Beantwortet
how to create a struct that would have number of fields that corresponds to the number of iterations inside a loop and also automatically save this data
Result = struct(); for day = 1:7 % No loop needed: MPE1 = signal(:, :, day) - signal(:, :, day) - kE1 * (signal(:, ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to create all possible matrices of zeros and ones without having more than one '1' in the same column?
n = 3; m = 4; c = n^m; X = cell(1, c); % List of outputs v = n .^ (1-m:0); % Calculate expensive power operation once f...

mehr als 3 Jahre vor | 0

Beantwortet
Error using plot vectors must be the same length
The error message is clear. Use the debugger to examine the reasons: dbstop if error Type this in the command window an run th...

mehr als 3 Jahre vor | 0

Beantwortet
MATLAB and several command prompt commands
Try this under Windows: for i = 0:7 command = sprintf('tftp -i 192.168.178.100 get dmafiles-%d && exit &', i); % ...

mehr als 3 Jahre vor | 0

Beantwortet
complicated vectorization of for loop wich icludes if and referes back to last loop iteration results
Why do you assume, that a vectorization is faster? Neither loops nor IF-conditions are slow in modern Matlab versions. Your cod...

mehr als 3 Jahre vor | 0

Beantwortet
I am facing an error "invalid file identifier" while using fprintf and fopen
Whenever you try to open a file, check the success: [file_1, msg] = fopen(outputFileName, 'w'); assert(file_1 > 0, msg); Now ...

mehr als 3 Jahre vor | 1

Gesendet


FileRename
Fast renaming of files or folders

mehr als 3 Jahre vor | 1 Download |

5.0 / 5
Thumbnail

Beantwortet
how to solv this issue?
Replace y=eval(fx); by y = fx(x) and switch grd case 'on' grid on; case 'off' grid off; end by the easier: gr...

mehr als 3 Jahre vor | 0

Beantwortet
how come with same formula, i get two different results in Matlab
See Torsten's comment for the limited precision, if you use 4 decimal places only. In addition, multiplying with the inverse is...

mehr als 3 Jahre vor | 0

Beantwortet
how to write a code for two input -one output function (f=@(v,r)) using bisection method?
pi = 3.14; % Brrrr G = 6.67e-11; M = 2e30; c = 1e4; rho = 1e-21; n = 2.5; gamma = 1 + 1/n; dotm = pi*G^2*M^2*(rho/c^3) * (2...

mehr als 3 Jahre vor | 0

Beantwortet
I HAVE THE FOLLOWING ERROR: "Error using bvparguments" HELP ME TO FIX IT
The code does not run. linspace(0,infinity,40) - what is "infinity" and of course you cannot divide the interval [0, Infinity] ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Can you help solving this differential equation using ode15i, please?
dx_dz = ??? x_p = ??? V = ??? Z = ??? h = ??? tspan = [0, 10]; % ??? x0 = rand(1, 5); % ??? [Z, Y] = ode15s(@(z, x) MS_A...

mehr als 3 Jahre vor | 0

Beantwortet
index exceeds the number of array elements. Index must not exceed 1.
Omit the confusing j = 0; It does not have any effect, because the for j command overwrites the value immediately. If Z and/o...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
How to solve 1.0000 not equal to 1 in MATLAB?
Welcome to the world of numerical maths. Remember, that the summation is numerically instable. Even a reordering of the element...

mehr als 3 Jahre vor | 1

Beantwortet
Returning Multiple Variables from a function to be added to existing variable.
What about: [k_1,K_1,B1,b1,c1]=element_stiffness([2,4,1],Coords, v,E,t,D) k = [k, k_1]; % Or: k = k + k_1; % Or: k = z...

mehr als 3 Jahre vor | 0

Beantwortet
How to find max values in vector for each 10 rows
With the bold guess, that you mean rand(100, 1) instead of rand(1:100): data = rand(100, 1); result = max(reshape(data, 10, ...

mehr als 3 Jahre vor | 0

| akzeptiert

Mehr laden