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

4 years ago | 0

| accepted

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

4 years ago | 0

| accepted

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

4 years ago | 0

| accepted

Answered
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 years ago | 1

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

4 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
'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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Question


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 years ago | 2 answers | 0

2

answers

Answered
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 years ago | 0

Answered
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 years ago | 1

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 1

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

4 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

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

4 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 1

Load more