Beantwortet
Why do I receive an error with the save function?
save gets the name of the variable, nit the variable itself: save(matFile, 'mypadCBCTimage', '-append', '-nocompression'); % ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
Problem using if statements in for loop
Welcome to the world of numerical maths. See: FAQ: Why is 0.3-0.2-0.1 not equal to zero? The standard example is: any((0:0.1:1...

mehr als 4 Jahre vor | 0

Beantwortet
Moving Average with timestep
A simple average over 2 elements (length of M can be even or odd): Len = numel(M); v = (M(1:2:Len - rem(Len, 2)) + M(2:2:Len...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
Assign nearest maximum value.
Why 30 and not 20? Both have a distance of 5. A = [10,20,30,40]; S = 25; [~, index] = min(abs(A - S)); A(index)

mehr als 4 Jahre vor | 0

Beantwortet
Why won't this ODE setup work?
Omit the "(t)" in the output: [ceSol, csSol, cesSol, cpSol]= dsolve(odes,conds);

mehr als 4 Jahre vor | 0

Beantwortet
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

mehr als 4 Jahre vor | 1

Beantwortet
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...

mehr als 4 Jahre vor | 0

Beantwortet
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');

mehr als 4 Jahre vor | 0

Beantwortet
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 ...

mehr als 4 Jahre vor | 2

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

mehr als 4 Jahre vor | 0

Beantwortet
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); ...

mehr als 4 Jahre vor | 0

Beantwortet
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 ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 4 Jahre vor | 0

Beantwortet
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, '...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 4 Jahre vor | 0

Beantwortet
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...

mehr als 4 Jahre vor | 0

Beantwortet
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 ...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
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 ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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 ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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 ...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 4 Jahre vor | 0

Beantwortet
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...

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

Beantwortet
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...

mehr als 4 Jahre vor | 0

Beantwortet
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...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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=...

mehr als 4 Jahre vor | 0

Beantwortet
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...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 4 Jahre vor | 1

Mehr laden