Answered

interpret a simple matrix code

I recommend to use the free Matlab tutorials to learn the basics: https://www.mathworks.com/learn/tutorials/matlab-onramp.html ...

interpret a simple matrix code

I recommend to use the free Matlab tutorials to learn the basics: https://www.mathworks.com/learn/tutorials/matlab-onramp.html ...

23 days ago | 0

| accepted

Answered

Calculate the volume of a body

x1 = [-0.5, 3.90]; y1 = [-0.5, 3.70]; x2 = [-3.90, 0.5]; y2 = [-3.70, 0.5]; axes('NextPlot', 'add'); line(x1([1,1,2,2,1])...

Calculate the volume of a body

x1 = [-0.5, 3.90]; y1 = [-0.5, 3.70]; x2 = [-3.90, 0.5]; y2 = [-3.70, 0.5]; axes('NextPlot', 'add'); line(x1([1,1,2,2,1])...

23 days ago | 1

Answered

How to create price weighted index function?

Start with using Matlab methods instead of the loops: avg = AvgPrice2019; meanAavg = sum(avg); pweight = avg / meanAvg;...

How to create price weighted index function?

Start with using Matlab methods instead of the loops: avg = AvgPrice2019; meanAavg = sum(avg); pweight = avg / meanAvg;...

23 days ago | 0

| accepted

Answered

Can someone help me understand why I cant get a graph with an alpha of 0.001

With alpha = 0.1 only the 3rd case of the if-branches occurs. Then dxdt is replied as [3 x 1] vector. With alpha = 0.001 the fi...

Can someone help me understand why I cant get a graph with an alpha of 0.001

With alpha = 0.1 only the 3rd case of the if-branches occurs. Then dxdt is replied as [3 x 1] vector. With alpha = 0.001 the fi...

23 days ago | 1

Answered

How do I verify if a structure array is a subset of another structure array

You have to write your own tool to test for your definition of a struct-subset. Maybe: % [UNTESTED CODE] function T = isStruct...

How do I verify if a structure array is a subset of another structure array

You have to write your own tool to test for your definition of a struct-subset. Maybe: % [UNTESTED CODE] function T = isStruct...

23 days ago | 0

| accepted

Answered

please help, how can i create the following matrix? 𝒂 = ( 𝒆 𝟏 𝒏 𝒏 𝒎 𝒆 𝟐 𝒏 𝒎 𝒎 𝒆 𝟑 ⋯ 𝒏 𝒏 𝒏 𝒏 𝒏 𝒏 ⋮ ⋱ ⋮ 𝒎 𝒎 𝒎 ⋯ 𝒆 𝒏 𝒏)

Use the functions triu, diag and tril . Another option is to start with zeros(m, n) and running 2 for loops. Then compare the i...

please help, how can i create the following matrix? 𝒂 = ( 𝒆 𝟏 𝒏 𝒏 𝒎 𝒆 𝟐 𝒏 𝒎 𝒎 𝒆 𝟑 ⋯ 𝒏 𝒏 𝒏 𝒏 𝒏 𝒏 ⋮ ⋱ ⋮ 𝒎 𝒎 𝒎 ⋯ 𝒆 𝒏 𝒏)

Use the functions triu, diag and tril . Another option is to start with zeros(m, n) and running 2 for loops. Then compare the i...

23 days ago | 0

Answered

how to store the conditional loop data

Your cleaned code: ut = rand(15, 1); uy = [0.84; 0.384; 0.784]; U_y = repmat(uy, 5, 1); for n = 1:15 if ut(n) > U_y(n...

how to store the conditional loop data

Your cleaned code: ut = rand(15, 1); uy = [0.84; 0.384; 0.784]; U_y = repmat(uy, 5, 1); for n = 1:15 if ut(n) > U_y(n...

23 days ago | 0

Answered

Sorting a BigInteger array

How dod you create the array? Please post a short example. I seems that you are talking about a Java class, not a Matlab array. ...

Sorting a BigInteger array

How dod you create the array? Please post a short example. I seems that you are talking about a Java class, not a Matlab array. ...

23 days ago | 0

| accepted

Answered

Matrix or vector operation faster?

The number of multiplications is the same in both versions, as far as I can see. So I'd expect both to need almost the same time...

Matrix or vector operation faster?

The number of multiplications is the same in both versions, as far as I can see. So I'd expect both to need almost the same time...

23 days ago | 0

| accepted

Answered

Populate a 1000x1000 array with rows where a value is added every second, then third etc. column

You want an output of size 1000x1000: M = zeros(1000, 1000); You want a loop to go from 1 to 1000: for k = 1:1000 ... e...

Populate a 1000x1000 array with rows where a value is added every second, then third etc. column

You want an output of size 1000x1000: M = zeros(1000, 1000); You want a loop to go from 1 to 1000: for k = 1:1000 ... e...

24 days ago | 1

| accepted

Answered

How can I import "curl" API in MATLAB using webread function?

What about using curl instead? This is included in Linux, MacOS and Windows also: system(['curl "https://www.sapsailing.com/sai...

How can I import "curl" API in MATLAB using webread function?

What about using curl instead? This is included in Linux, MacOS and Windows also: system(['curl "https://www.sapsailing.com/sai...

24 days ago | 1

| accepted

Answered

Finding allowed inputs to a function

Not in general. If a function uses the modern arguments block (since R2019b), this is possible. But many users are running older...

Finding allowed inputs to a function

Not in general. If a function uses the modern arguments block (since R2019b), this is possible. But many users are running older...

24 days ago | 0

Answered

how to find sum different data for two different variables using loop in matlab

Maybe you want to do: "Multiply each element of vector a with all elements of vector b, devide by 100 and get the sum of all res...

how to find sum different data for two different variables using loop in matlab

Maybe you want to do: "Multiply each element of vector a with all elements of vector b, devide by 100 and get the sum of all res...

24 days ago | 0

Answered

Matrix is singular to working precision

Why do you assume, that something is wrong? The provided matrix is near to singular. In 1-D this would mean, that you try to div...

Matrix is singular to working precision

Why do you assume, that something is wrong? The provided matrix is near to singular. In 1-D this would mean, that you try to div...

24 days ago | 0

Answered

Solve the following simultaneous equations:

f1 = @(t,y) [-X/theta+(1+alpha)*y1(1-X)*Y^2+beta*y1(1-X)*Z^2; ... ... % ^ ^ * are ...

Solve the following simultaneous equations:

f1 = @(t,y) [-X/theta+(1+alpha)*y1(1-X)*Y^2+beta*y1(1-X)*Z^2; ... ... % ^ ^ * are ...

25 days ago | 0

| accepted

Answered

converting a matrix into a column vector using only while-end loop

This sounds like a homework question and you have shown, what you have tried so far. function A = func4(M) [m,n] = size(M); A...

converting a matrix into a column vector using only while-end loop

This sounds like a homework question and you have shown, what you have tried so far. function A = func4(M) [m,n] = size(M); A...

25 days ago | 0

| accepted

Answered

Rename files after a certain string in the file itself appears

An explicit example would be useful: old name and new name. Maybe: files_csv = dir('*.csv'); for i = 1 : length(files_csv) ...

Rename files after a certain string in the file itself appears

An explicit example would be useful: old name and new name. Maybe: files_csv = dir('*.csv'); for i = 1 : length(files_csv) ...

25 days ago | 0

| accepted

Answered

what's the code inside angle2dcm?

While I cannot find the code of angle2dcm , the equivalent function eul2rotm is useful for the explanation also. It produces the...

what's the code inside angle2dcm?

While I cannot find the code of angle2dcm , the equivalent function eul2rotm is useful for the explanation also. It produces the...

25 days ago | 0

Answered

I am trying to make a new matrix for each iteration of a for loop

Q_bar = cell(1, length(theta)); for i = 1:length(theta) m = cosd(theta(i)); n = sind(theta(i)); T1 = [m^2, n^2, ...

I am trying to make a new matrix for each iteration of a for loop

Q_bar = cell(1, length(theta)); for i = 1:length(theta) m = cosd(theta(i)); n = sind(theta(i)); T1 = [m^2, n^2, ...

25 days ago | 1

Answered

While loop execution with multiple numeric and logical conditions

The code looks fine. Do you have a problem with it? It is a good programming practice to avoid repeated code. Maybe this is "cl...

While loop execution with multiple numeric and logical conditions

The code looks fine. Do you have a problem with it? It is a good programming practice to avoid repeated code. Maybe this is "cl...

25 days ago | 1

| accepted

Answered

Failure in initial objective function evaluation. FSOLVE cannot continue.

You provide a handle to a script. This cannot work, because fsolve expects a function handle. Most likely you want: fsolve(@fcn...

Failure in initial objective function evaluation. FSOLVE cannot continue.

You provide a handle to a script. This cannot work, because fsolve expects a function handle. Most likely you want: fsolve(@fcn...

25 days ago | 0

| accepted

Answered

Error using quiver The size of X must match the size of U or the number of columns of U.

x = -10:10; % No need for meshgrid since Matlab R2016b y = (-10:10).'; % simply use a row and a column vector k = 1; q...

Error using quiver The size of X must match the size of U or the number of columns of U.

x = -10:10; % No need for meshgrid since Matlab R2016b y = (-10:10).'; % simply use a row and a column vector k = 1; q...

25 days ago | 1

| accepted

Answered

How does MATLAB REALLY pass arguments to functions?

See this blog about inplace operations: https://blogs.mathworks.com/loren/2007/03/22/in-place-operations-on-data/ And the docum...

How does MATLAB REALLY pass arguments to functions?

See this blog about inplace operations: https://blogs.mathworks.com/loren/2007/03/22/in-place-operations-on-data/ And the docum...

25 days ago | 2

| accepted

Answered

How to register high resolution images of same modality?

If you image is stored in double format, it uses 10 GB of RAM. On a 64 GB machine this should work. So is installing more RAM an...

How to register high resolution images of same modality?

If you image is stored in double format, it uses 10 GB of RAM. On a 64 GB machine this should work. So is installing more RAM an...

25 days ago | 1

Answered

How to campare signals with different length?

It depends. You can compare two sine waves, if one has 80 and the other one 75 samples. But how do you define "similarity"? You...

How to campare signals with different length?

It depends. You can compare two sine waves, if one has 80 and the other one 75 samples. But how do you define "similarity"? You...

25 days ago | 0

Answered

How to I iterate a random selection among given elements without selecting the same element twice?

By the way, your code wouzld be much cleaner and shorter, if you use arrays instead of hiding indices in the field names: Define...

How to I iterate a random selection among given elements without selecting the same element twice?

By the way, your code wouzld be much cleaner and shorter, if you use arrays instead of hiding indices in the field names: Define...

25 days ago | 1

| accepted

Answered

What are the ideal computer specs for parallel computing with large data sets?

If the RAM is exhausted, the SSD or HDD is used as virtual RAM. This slows down the processing massively. You would see this by ...

What are the ideal computer specs for parallel computing with large data sets?

If the RAM is exhausted, the SSD or HDD is used as virtual RAM. This slows down the processing massively. You would see this by ...

26 days ago | 2

| accepted

Answered

Error when saving figure with linux command line

In batch mode, Matlab does not support interactive GUI elements. How do you save the figure as PNG? See: https://www.mathworks....

Error when saving figure with linux command line

In batch mode, Matlab does not support interactive GUI elements. How do you save the figure as PNG? See: https://www.mathworks....

26 days ago | 0

Answered

Unable to perform assignment because the left and right sides have a different number of elements.

Schwerp_X = first_Moment_X./en_density; Schwerpunkte_X(i) = Schwerp_X; first_Moment_X is a vector, so is Schwerp_X,...

Unable to perform assignment because the left and right sides have a different number of elements.

Schwerp_X = first_Moment_X./en_density; Schwerpunkte_X(i) = Schwerp_X; first_Moment_X is a vector, so is Schwerp_X,...

26 days ago | 0

| accepted

Answered

How do I vectorize my nested for loops for a convolution operation example?

Not a vectorization, but some tiny changes, which let the code tun 30% faster (at least in Matlab online - test this locally!): ...

How do I vectorize my nested for loops for a convolution operation example?

Not a vectorization, but some tiny changes, which let the code tun 30% faster (at least in Matlab online - test this locally!): ...

26 days ago | 0

| accepted