Beantwortet
not able to solve the integration function
This cannot work: x(j) = linspace(0,0.025,101); On the left is a scalar and on the right a vector with 101 elements. Seeing o...

mehr als 4 Jahre vor | 0

Beantwortet
How to work with Struct With Struct construction
It is not clear, how the inputs data exactly look and what you want as output. Prefer to post some code, which produces both. M...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
Create diagonals along a block matrix
With some bold guessing and knowing, that this might be more confusing than useful: The input A is a cell vector and the wanted...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
Why do I get "Array indices must be positive integers or logical values." Error
global net_stg9; % Previously trained network netw = net_stg9; my_output = netw(my_input); netw seems to be an array, not a t...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to plot 50 figures each has 3 curves for loop
You show us the code to create one set of lines. Then simply add this command before plotting: figure() axes('NextPlot', 'add'...

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 1

Beantwortet
Inverse of matrix multiplied by vector
K = [ 168.57 4296.29 7250; ... 0 998888.89 241666.67; ... 0 0 106333...

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 1

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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(:,...

mehr als 4 Jahre vor | 1

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

Frage


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

mehr als 4 Jahre vor | 2 Antworten | 0

2

Antworten

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 1

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

mehr als 4 Jahre vor | 1

| akzeptiert

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

mehr als 4 Jahre vor | 1

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

mehr als 4 Jahre vor | 0

Beantwortet
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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

Beantwortet
How to write this expression in MatLab
x * exp(log(2^x)) = 1

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

Mehr laden