답변 있음
For loop not working for me
xx = x_initial:dx:-1*x_initial; if xx(i) == -1.75e-6 You cannot expect a specific value in the vector xx, because it is create...

4년 초과 전 | 1

답변 있음
Inverse of matrix multiplied by vector
K = [ 168.57 4296.29 7250; ... 0 998888.89 241666.67; ... 0 0 106333...

4년 초과 전 | 0

답변 있음
Sum 2 Matrices and take the average value of their summation and store them in another Matrix with the same dimension.
"I want to take the average of the sum of these two variables, then store the new value in C_Total_up" C_Total_up = (C_Total_1 ...

4년 초과 전 | 0

| 수락됨

답변 있음
'The variable appears to change size on every loop iteration'
Some hints: addpath(user_direct); - Append only folders to Matlab's path, which contain M-files. Avoid to include folders cont...

4년 초과 전 | 0

답변 있음
How do I use the cat function?
Whenever you have an error for a specific command, read the help section at first: help cat % Or more exhaustive: doc cat Yo...

4년 초과 전 | 0

| 수락됨

답변 있음
Find discontinuities and lift up or pull down the part after the discontinuity
x = linspace(1, 10*pi, 200); y = sin(x); y(60:90) = y(60:90) + 1; y(120:180) = y(120:180) - 1; yOrig = y; limit = 0.2; d...

4년 초과 전 | 1

| 수락됨

답변 있음
How to collate two mat files with similar name pattern from two different sub-folders?
Maybe you want: all_Mt2files = dir(fullfile(subfolder1, '*.mat')); all_Dotfiles = dir(fullfile(subfolder2, '*.mat')); for k...

4년 초과 전 | 0

| 수락됨

답변 있음
vectorization of comparison against several intervals
Easier to run in the forum and maybe faster already: N = 1000; M = randi([1, 1000], N, N); C = sort(randi([1, 1000], 100, 2),...

4년 초과 전 | 0

| 수락됨

답변 있음
How to speedup the following
N = 200; A = rand(N, N, N); D = rand(N, 1); tic % Original S = zeros(N); for i = 1:N for j = 1:N S = S + A(:,...

4년 초과 전 | 1

| 수락됨

답변 있음
How to delete an item in a matrix by comparing the correlation with the next neighbor in a same column
With bold guessing: A=[0,0,0,0,0,0,11,22,33,44,63,23,6,0,0,3,4,6,7,3,4,0,5,0,0,9,4,14,22,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0; ... ...

4년 초과 전 | 0

답변 있음
how to get a plot of second ODE
The interval is: tspan = [0 50] In the first step you evaluate: yp(2)= y(1) / (t.*j) - (y(1)/(t.^2 .*j)) - (3.*y(2)./t) for t...

4년 초과 전 | 0

| 수락됨

질문


Why is the string type not implemented as standard type?
The string type is impelemented as opaque class and not as standard type as doubles of chars. This makes it inefficient to acces...

4년 초과 전 | 답변 수: 2 | 0

2

답변

답변 있음
Really am I simulation this system with ODE45? How am I can optimizing the code?
Your function to integrated contains linear intepolations of parameters. Then the outpuzt is not smooth. Matlab's ODE intergrato...

4년 초과 전 | 0

답변 있음
Timer with very precise period time
Under ideal conditions a high accuracy timer of the operating system inside a C-mex function. See e.g. FEX: HAT . But remember, ...

4년 초과 전 | 1

답변 있음
Composition of two matrices with the same number of columns, one of them is integer-valued
n = 1e4; m = 1e4; d = 1e3; B = randi([1, m], n, d); A = randn(m, d) * 2; % Version 1: The original code tic C = zer...

4년 초과 전 | 1

| 수락됨

답변 있음
Simulating earth rotating the sun with eulers method.
When I run your code, I do not see a linear movement: %Constants and initialising vectors G=6.674*10^(-11); %gravitational co...

4년 초과 전 | 1

답변 있음
Error using fileparts with Datastore
Try: [~, filenames] = fileparts(cellstr(ds.Files)) But actually this should work. Which Matlab version are you using? spreadsh...

4년 초과 전 | 0

답변 있음
Convex Hull without the in-built function.
There are many known algorithms, which can inspire you. See https://en.wikipedia.org/wiki/Convex_hull_algorithms

4년 초과 전 | 0

답변 있음
I have a problem with writing data to file
The folder might be write protected. Check this in general: [fid, msg] = fopen('mn21hmya2021.csv','wt'); assert(fid > 0, msg);...

4년 초과 전 | 0

답변 있음
SELECTING MATRIX ELEMENTS IN DESCENDING ORDER
This can be obtained by the 2nd output of the sort() command. A=[57 60 62 64 69 67 68 63 36 33; 52 45 25 37 49 55 58 49 39 3...

4년 초과 전 | 0

답변 있음
How to write this expression in MatLab
x * exp(log(2^x)) = 1

4년 초과 전 | 0

| 수락됨

답변 있음
Removing zeros from matrix
What is the wanted output? A = [1 2 3 4 5 6; 1 2 3 4 5 6; 1 2 3 4 5 0; 1 2 3 4 0 0; 1 2 3 0 0 0]; B1 = A; B1(B1 == 0) = NaN...

4년 초과 전 | 0

답변 있음
How can I get the source code of the function rationalfit()? This function does not contain the code.
Scroll down. On the bottom of the function rationalfit.m you find the call of a core function. Either this core function contain...

4년 초과 전 | 0

| 수락됨

답변 있음
Import files from two folders
The error message is clear: Undefined function 'Importing' This means, that this function is not visible. If it was working be...

4년 초과 전 | 0

| 수락됨

답변 있음
Generating an average curve from 1,000 replicates of an ODE
I cannot run your code due to a missing function lhdesign, but I guess you want: avg = mean([result{:}(:, 2)], 2);

4년 초과 전 | 0

답변 있음
Insert two text lines in the blank rows of a txt file
You cannot insert text in files, because a file an grow at its end only. There is no operation to shift the contents of a file. ...

4년 초과 전 | 0

답변 있음
Remove value question: if previous row -row>+-3, then remove the row in matrix A
Your code contains some problems: for j = 1:size(A) Remember, that size() replies a vector containing the size of all dimensio...

4년 초과 전 | 1

답변 있음
Please help me to find the errors in my code for predictor corrector method.
I do not know, what you consider as "correct" result. All I see is the running code and there is no chance to predict, what you ...

4년 초과 전 | 0

답변 있음
What is the fastest way to get bit stream from 1D float data ?
I do not really get, what you try to do. Which format does the audiofile have? What do you call "bit stream"? Instead of explai...

4년 초과 전 | 0

답변 있음
Need help with error in for loop
Your code tests f1<f2 and f1>f2, but not f1 == f2. In this case x1(i+1) and x2(i+2) are not created. r = (sqrt(5)-1) / 2; d = ...

4년 초과 전 | 0

더 보기