Answered

Is there a better way to solve this multidimensional array?

For the first averaging % temp_mean = nanmean(M,4); For the 2nd annual avg use % A=reshape(M,19,3,6,siz...

Is there a better way to solve this multidimensional array?

For the first averaging % temp_mean = nanmean(M,4); For the 2nd annual avg use % A=reshape(M,19,3,6,siz...

mer än 3 år ago | 0

| accepted

Answered

How to keep equal distancing between markers while moving??

Since you are in a periodic space, scaling the angle will not preserve the distance, you should use addition ( translate the ang...

How to keep equal distancing between markers while moving??

Since you are in a periodic space, scaling the angle will not preserve the distance, you should use addition ( translate the ang...

mer än 3 år ago | 0

| accepted

Answered

Using Explicit Finite Difference Method to Determine the Time at which Unsteady State Ends - 1D Heat transfer

Your dicretization much satisfy the stability condition since the explicit scheme is conditionally stable. Moreover, The error m...

Using Explicit Finite Difference Method to Determine the Time at which Unsteady State Ends - 1D Heat transfer

Your dicretization much satisfy the stability condition since the explicit scheme is conditionally stable. Moreover, The error m...

mer än 3 år ago | 0

Answered

Vectors must of same length while plotting

You have t1 which started by 60 length then added 1 then 1 more plotted with 62 length. Whereas x1_t3 started with 60 then add 1...

Vectors must of same length while plotting

You have t1 which started by 60 length then added 1 then 1 more plotted with 62 length. Whereas x1_t3 started with 60 then add 1...

mer än 3 år ago | 0

| accepted

Answered

how to find area under the curve ?

Use polyarea(x,y); you need to have a polygon; That is, ur first point must by ur lasr point. You can do so by adding this to ...

how to find area under the curve ?

Use polyarea(x,y); you need to have a polygon; That is, ur first point must by ur lasr point. You can do so by adding this to ...

mer än 3 år ago | 0

Answered

Concatenate variables with similar names

@Ricardo Duarte Here is a trick, you will save all your workplace into one variable b; then loop over all of them to take whose ...

Concatenate variables with similar names

@Ricardo Duarte Here is a trick, you will save all your workplace into one variable b; then loop over all of them to take whose ...

mer än 3 år ago | 0

Answered

Scatter plot with colorbar showing density of points

You can for example measure the distance between all the coordinates, then take the inverse of minimum distance or average of al...

Scatter plot with colorbar showing density of points

You can for example measure the distance between all the coordinates, then take the inverse of minimum distance or average of al...

mer än 3 år ago | 1

Answered

How to combine n cell arrays into one giant one?

I think you need to loop a bit since you have cells of cells. Let A and B are ur outer cell matrices, data and labels ...

How to combine n cell arrays into one giant one?

I think you need to loop a bit since you have cells of cells. Let A and B are ur outer cell matrices, data and labels ...

mer än 3 år ago | 0

Answered

How to find the 12th highest value for every year

Since you already sorted them, what you need to do now is call the first highest 12 as follows % Assuming the matrix is...

How to find the 12th highest value for every year

Since you already sorted them, what you need to do now is call the first highest 12 as follows % Assuming the matrix is...

mer än 3 år ago | 1

Answered

Indexing vectors in a cell matrix with for loops?

if true % You can either use this A{1}(1:3,:) %to extract the first 3 rows of the 1st matrix, and the same for all. ...

Indexing vectors in a cell matrix with for loops?

if true % You can either use this A{1}(1:3,:) %to extract the first 3 rows of the 1st matrix, and the same for all. ...

mer än 3 år ago | 0

| accepted

Answered

How to check the complementary time-dependent term of differential equations.

% Try this function [T1,Y1] = ode_param_sample1() TSPAN = [0 pi/2]; IC = 1; tv = linspace(0,pi/2,10); ftv = si...

How to check the complementary time-dependent term of differential equations.

% Try this function [T1,Y1] = ode_param_sample1() TSPAN = [0 pi/2]; IC = 1; tv = linspace(0,pi/2,10); ftv = si...

mer än 3 år ago | 0

Answered

How can call a vector element using index in the condition of if_else loop?

% A faster way R(m,1)=randi([5 40],length(m),1); R(n,1)=randi([5 40],length(n),1); R(o,1)=randi([5 40],length(o),1); ...

How can call a vector element using index in the condition of if_else loop?

% A faster way R(m,1)=randi([5 40],length(m),1); R(n,1)=randi([5 40],length(n),1); R(o,1)=randi([5 40],length(o),1); ...

mer än 3 år ago | 0

Answered

How can call a vector element using index in the condition of if_else loop?

% Try this R=P(:,6); m =find(R==40); n =find(R==25); o =find(R==15); p =find(R==8) for k= 1:6160 if ismember(k,...

How can call a vector element using index in the condition of if_else loop?

% Try this R=P(:,6); m =find(R==40); n =find(R==25); o =find(R==15); p =find(R==8) for k= 1:6160 if ismember(k,...

mer än 3 år ago | 0

| accepted

Question

RL in dynamic environment

I am trying to apply RL in marine environment. An example is when a fish swims toward its altimate goal, it should avoid bad wea...

mer än 3 år ago | 1 answer | 0

Answered

How do i turn my 4D matrix into a 3D matrix

I think you cannot convert 4D matrix into 3D if non of the dimensions is equal one. If A is of size (100×50×1×20) lon, lat, ...

How do i turn my 4D matrix into a 3D matrix

I think you cannot convert 4D matrix into 3D if non of the dimensions is equal one. If A is of size (100×50×1×20) lon, lat, ...

mer än 3 år ago | 0

Answered

Exporting a 3D array to python

Ths simplest way is to export it as .dat file where python can read it too. % example x = rand(100) save file.dat x -a...

Exporting a 3D array to python

Ths simplest way is to export it as .dat file where python can read it too. % example x = rand(100) save file.dat x -a...

mer än 3 år ago | 1

Answered

How to remove horizontal lines as plotting 0-360 degree map

Make sure to clear the figure before plotting because the coast.mat does not have these lines.

How to remove horizontal lines as plotting 0-360 degree map

Make sure to clear the figure before plotting because the coast.mat does not have these lines.

mer än 3 år ago | 0

Answered

Given an integer number n (0<=n<10000), write a code returning the difference between the product of its digits and the sum of its digits.

% check this a = 4321; b=str2num(num2str(a)'); diff = abs(sum(b)- prod(b))

Given an integer number n (0<=n<10000), write a code returning the difference between the product of its digits and the sum of its digits.

% check this a = 4321; b=str2num(num2str(a)'); diff = abs(sum(b)- prod(b))

mer än 3 år ago | 0

Answered

How to break loop when successive values are too close

check this example; % examle tol=1e-4 xold=1e10 for i =1:100 xnew = .... if abs(xnew-xold) < tol break end xold=...

How to break loop when successive values are too close

check this example; % examle tol=1e-4 xold=1e10 for i =1:100 xnew = .... if abs(xnew-xold) < tol break end xold=...

mer än 3 år ago | 0

| accepted

Answered

Plot contours using discrete data points

% try this contour(X,Y,Z) or % this contourf(X,Y,Z)

Plot contours using discrete data points

% try this contour(X,Y,Z) or % this contourf(X,Y,Z)

mer än 3 år ago | 0

Answered

How to plot streamlines for a fea unstructured mesh with given u,v velocities?

% try quiver(x,y,u,v)

How to plot streamlines for a fea unstructured mesh with given u,v velocities?

% try quiver(x,y,u,v)

mer än 3 år ago | 0

Answered

Saving output of a for loop for each iteration

% code u=unique(condIds,'stable'); for ii = 1:length(u) myTrials{ii} = find(condIds == u(ii)); map = d.mkSal...

Saving output of a for loop for each iteration

% code u=unique(condIds,'stable'); for ii = 1:length(u) myTrials{ii} = find(condIds == u(ii)); map = d.mkSal...

mer än 3 år ago | 0

Answered

putting a threshold into array values

Assume your matrix is A, and b is the threshold % code B= A(A(:,2)>b,:);

putting a threshold into array values

Assume your matrix is A, and b is the threshold % code B= A(A(:,2)>b,:);

mer än 3 år ago | 1

| accepted

Answered

How can I subtract the absolute value of the original image from the absolute value of the resized image to compare and to find the error in Matlab

No you resize the image it takeout part of the pkls, so the size of the matrices will for sure be smaller. Thus u cannot find th...

How can I subtract the absolute value of the original image from the absolute value of the resized image to compare and to find the error in Matlab

No you resize the image it takeout part of the pkls, so the size of the matrices will for sure be smaller. Thus u cannot find th...

mer än 3 år ago | 0

Answered

Trying to plot number of iterations vs gridsize for steady state

Hi, this looks like a diffusion equation solved by FDM. you had to mistakes, I already corrected them, n is the step size or gri...

Trying to plot number of iterations vs gridsize for steady state

Hi, this looks like a diffusion equation solved by FDM. you had to mistakes, I already corrected them, n is the step size or gri...

mer än 3 år ago | 0

Answered

How to keep constant weights in a Neural Network?

Assume u have 5 inputs 10 ne. (for only on hidden layer). First, generate yourself a random matrix of size 5x10, then save it. ...

How to keep constant weights in a Neural Network?

Assume u have 5 inputs 10 ne. (for only on hidden layer). First, generate yourself a random matrix of size 5x10, then save it. ...

mer än 3 år ago | 0