Answered

Defining a simple function with text/string 'on'

function darkmode(a) gca; if a ans.GridColor = [1, 1, 1]; set(ans,'color','k'); else ans.GridColor = [.15,.15,...

Defining a simple function with text/string 'on'

function darkmode(a) gca; if a ans.GridColor = [1, 1, 1]; set(ans,'color','k'); else ans.GridColor = [.15,.15,...

environ 10 heures ago | 0

Answered

Average of 2 columns within a 3 column matrix

for k=1:60 x(k)=mean(X(:,:,k),'all','omitnan'); end

Average of 2 columns within a 3 column matrix

for k=1:60 x(k)=mean(X(:,:,k),'all','omitnan'); end

1 jour ago | 0

Answered

Bessel function. Determining the roots.

Looks like file exchange has a good zero finder for Bessel functions. https://www.mathworks.com/matlabcentral/fileexchange/4840...

Bessel function. Determining the roots.

Looks like file exchange has a good zero finder for Bessel functions. https://www.mathworks.com/matlabcentral/fileexchange/4840...

1 jour ago | 0

Answered

I want to calculate each v value from each diameter value, then the value of Re one by one, and for all the calculations in the for loop,but this code give me single value for v, Re, f . Where am I doing wrong? Sorry I'm beginner in mtlab.

No loop needed. L=(2000+(5*50)); T=5+5*0.25; It=0.0075*L; ht=0.15*T; bt=0.50*It; e=0.0003*(5+50); t=15000/sqrt(9.81/ht); ...

I want to calculate each v value from each diameter value, then the value of Re one by one, and for all the calculations in the for loop,but this code give me single value for v, Re, f . Where am I doing wrong? Sorry I'm beginner in mtlab.

No loop needed. L=(2000+(5*50)); T=5+5*0.25; It=0.0075*L; ht=0.15*T; bt=0.50*It; e=0.0003*(5+50); t=15000/sqrt(9.81/ht); ...

1 jour ago | 0

| accepted

Answered

Why is histcount ignoring one of the edge values in my matrix?

a=readmatrix('GPeak_Histogram_Data.txt'); Aedges = unique(a(:,2)); Acounts = histc(a(:,2), Aedges);%use histc or a=readmatr...

Why is histcount ignoring one of the edge values in my matrix?

a=readmatrix('GPeak_Histogram_Data.txt'); Aedges = unique(a(:,2)); Acounts = histc(a(:,2), Aedges);%use histc or a=readmatr...

5 jours ago | 0

| accepted

Answered

pad matrix to a particular size

assuming m and n are both even. M_resized=padarray(M,[(150-size(M,1))/2 (150-size(M,2))/2],0,'both');

pad matrix to a particular size

assuming m and n are both even. M_resized=padarray(M,[(150-size(M,1))/2 (150-size(M,2))/2],0,'both');

5 jours ago | 1

Answered

How to evaluate a function that has been saved to a variable

syms x; f = 2*tanh(x/2); d1 = diff(f); d2 = diff(f,2); d3 = diff(f,3); fplot(f,[-1,1]); hold on; fplot(d1,[-1,1]); fplot...

How to evaluate a function that has been saved to a variable

syms x; f = 2*tanh(x/2); d1 = diff(f); d2 = diff(f,2); d3 = diff(f,3); fplot(f,[-1,1]); hold on; fplot(d1,[-1,1]); fplot...

5 jours ago | 1

Answered

How to reconstruct a matrix?

z=diag([y;0]); z(end,:)=x(1:length(z)); z(:,end)=x(1:length(z));

How to reconstruct a matrix?

z=diag([y;0]); z(end,:)=x(1:length(z)); z(:,end)=x(1:length(z));

5 jours ago | 1

Answered

Generating adjacency matrix for following network

Graph has to be a polygon. numNodes=6; a=randperm(numNodes); b=circshift(a,1); g=graph(a,b); plot(g); m=full(adjacency(g))...

Generating adjacency matrix for following network

Graph has to be a polygon. numNodes=6; a=randperm(numNodes); b=circshift(a,1); g=graph(a,b); plot(g); m=full(adjacency(g))...

5 jours ago | 0

| accepted

Answered

New to matlab. Trying to make a script to reorganize excel data

a=readcell('yourcellname'); b=unique(a(:,2)); newCell=b'; for k=1:length(b) newCell(2,k)={a(ismember(a(:,2),b{k}),1)}; en...

New to matlab. Trying to make a script to reorganize excel data

a=readcell('yourcellname'); b=unique(a(:,2)); newCell=b'; for k=1:length(b) newCell(2,k)={a(ismember(a(:,2),b{k}),1)}; en...

12 jours ago | 0

Answered

Relative Ranking of position in an array

If a is your matrix above. sum(find(a==1)-find(a==2)<0);

Relative Ranking of position in an array

If a is your matrix above. sum(find(a==1)-find(a==2)<0);

12 jours ago | 0

| accepted

Answered

Need helping in setting a for loop for the below code

u=unique(condIds,'stable');%not sure if you only want to go through the unique entries; otherwise, you will have duplicates for...

Need helping in setting a for loop for the below code

u=unique(condIds,'stable');%not sure if you only want to go through the unique entries; otherwise, you will have duplicates for...

14 jours ago | 0

Answered

Rerun script with different table input

You should always attempt to index. Put all your tables into a single cell array. t{1}=table1; t{2}=table2; %then index into ...

Rerun script with different table input

You should always attempt to index. Put all your tables into a single cell array. t{1}=table1; t{2}=table2; %then index into ...

14 jours ago | 0

| accepted

Solved

Cannon Ball

Given g (acceleration due to gravity) and desired altitude x, find the minimum ground velocity of a cannon ball to reach x.

15 jours ago

Solved

Basic electricity in a dry situation

⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ &#...

15 jours ago