Answered

Error while performing integration

Or don't even have a Zdirection function x=1:0.1:5; a=5; alpha=30*pi/180; beta=120*pi/180; Z=3; for i=1:length(x) z(i)...

Error while performing integration

Or don't even have a Zdirection function x=1:0.1:5; a=5; alpha=30*pi/180; beta=120*pi/180; Z=3; for i=1:length(x) z(i)...

12 días ago | 0

Answered

While Loop, with a user made function

You will need to figure out how you want to compare the maxtrices, less than (<) compares element-to-element producing a logical...

While Loop, with a user made function

You will need to figure out how you want to compare the maxtrices, less than (<) compares element-to-element producing a logical...

14 días ago | 0

Answered

How do I add to a cell array based on logicals?

There might be an easier way. Here is one with a single loop. b=num2str(B); b=b(b~=' '); [idx1,idx2]=regexp(b,'[0]+'); for k...

How do I add to a cell array based on logicals?

There might be an easier way. Here is one with a single loop. b=num2str(B); b=b(b~=' '); [idx1,idx2]=regexp(b,'[0]+'); for k...

14 días ago | 0

| accepted

Answered

How to delete every "n thru m" rows?

I might not understand your question fully. What is the size of your matrix? (260x1) yourMatrix(151:181,:)=[];%deletes rows in ...

How to delete every "n thru m" rows?

I might not understand your question fully. What is the size of your matrix? (260x1) yourMatrix(151:181,:)=[];%deletes rows in ...

14 días ago | 0

Answered

Morse Code Decoder help!

Look at what this does. word='Name'; word=upper(word); morseWord=morse(word-'@');

Morse Code Decoder help!

Look at what this does. word='Name'; word=upper(word); morseWord=morse(word-'@');

14 días ago | 0

Answered

write cell array of tables to a .txt file

out=[] for k=1:length(yourCell) out=[out,strjoin(yourCell{k}.Var1,'\t')]; end

write cell array of tables to a .txt file

out=[] for k=1:length(yourCell) out=[out,strjoin(yourCell{k}.Var1,'\t')]; end

14 días ago | 0

| accepted

Answered

Repeat matrix columns in pairs.

out=[repmat(A(:,1:2),1,2),repmat(A(:,3:4),1,2)];

Repeat matrix columns in pairs.

out=[repmat(A(:,1:2),1,2),repmat(A(:,3:4),1,2)];

14 días ago | 0

| accepted

Answered

How to find and print elements of a character array?

Use a cell array instead. mem={'ISNT-60','ISA55-55-6 b/b','ISMC-100 b/b','ISMC-125 b/b','ISMB-225','ISMC-175 b/b','ISHB-250','I...

How to find and print elements of a character array?

Use a cell array instead. mem={'ISNT-60','ISA55-55-6 b/b','ISMC-100 b/b','ISMC-125 b/b','ISMB-225','ISMC-175 b/b','ISHB-250','I...

14 días ago | 1

| accepted

Answered

Unable to update while loop condition

Not sure what your question is then. The following works just fine for me. while max(abs(Oij_k1-Oij_k))>tol && (k<Klim)

Unable to update while loop condition

Not sure what your question is then. The following works just fine for me. while max(abs(Oij_k1-Oij_k))>tol && (k<Klim)

15 días ago | 0

Answered

Problems replacing for-loops

There is nothing wrong with for-loops. The only thing you can vectorize is T T=0:tmax; for t=1:1:tmax S(t+1)=S(t)+(a-d*S(...

Problems replacing for-loops

There is nothing wrong with for-loops. The only thing you can vectorize is T T=0:tmax; for t=1:1:tmax S(t+1)=S(t)+(a-d*S(...

15 días ago | 0

| accepted

Answered

Unable to update while loop condition

Oij_k1=[1 1];%need to define before using while max(abs(Oij_k1-Oij_k))>tol || (k<Klim)%I believe you want >tol

Unable to update while loop condition

Oij_k1=[1 1];%need to define before using while max(abs(Oij_k1-Oij_k))>tol || (k<Klim)%I believe you want >tol

15 días ago | 0

Answered

Index exceeds matrix dimensions error

for j=1:M for i=1:N%changing to N-1 allows script to run q=(-K/2)*(A(i+1,j)-A(i,j)/dr);%A is 105x101 and N=105...

Index exceeds matrix dimensions error

for j=1:M for i=1:N%changing to N-1 allows script to run q=(-K/2)*(A(i+1,j)-A(i,j)/dr);%A is 105x101 and N=105...

15 días ago | 1

| accepted

Answered

scatter plot (need matlab script)

x=[2.6498, 5.4147, 7.7189, 7.9493, 7.2581, 47.5806, 44.1244, 78.4562, 73.3871, 74.3088, 91.8203, 96.659, 95.9677, 36.9816, 35.13...

scatter plot (need matlab script)

x=[2.6498, 5.4147, 7.7189, 7.9493, 7.2581, 47.5806, 44.1244, 78.4562, 73.3871, 74.3088, 91.8203, 96.659, 95.9677, 36.9816, 35.13...

15 días ago | 1

Answered

Specific Row/Column addition and subtraction in a N by M matrix

abs(sum(m(2,1:3))+sum(m(3:5,4))-sum(m(3,1:3))-sum(m(4:5,3)));

Specific Row/Column addition and subtraction in a N by M matrix

abs(sum(m(2,1:3))+sum(m(3:5,4))-sum(m(3,1:3))-sum(m(4:5,3)));

15 días ago | 0

Answered

Please help me with summation

d=3.6e-6;r=.15; n=1:1e6;%not quite infinate eqn=@(t)24/pi^2*sum((1./(n-.5).^2).*exp(-(n-.5).^2*pi^2*d*t/r^2))-12.5; T=fzero(e...

Please help me with summation

d=3.6e-6;r=.15; n=1:1e6;%not quite infinate eqn=@(t)24/pi^2*sum((1./(n-.5).^2).*exp(-(n-.5).^2*pi^2*d*t/r^2))-12.5; T=fzero(e...

15 días ago | 0

| accepted

Answered

How can I select numbers from excel to matlab?

str=readcell('test.xlsx'); %str={'2019-10-12T02:41:27.091Z,1/0669958925:52238,-5.9858581261e-02,-1.7725070822e-04,+1.1940838453...

How can I select numbers from excel to matlab?

str=readcell('test.xlsx'); %str={'2019-10-12T02:41:27.091Z,1/0669958925:52238,-5.9858581261e-02,-1.7725070822e-04,+1.1940838453...

16 días ago | 0

Answered

How to fix the range of a variable?

Not clear what the question is, but if you just want to randomly sectect 24 digits from 0-3, then: x=randi(4,1,24)-1;

How to fix the range of a variable?

Not clear what the question is, but if you just want to randomly sectect 24 digits from 0-3, then: x=randi(4,1,24)-1;

16 días ago | 0

Answered

How to plot the Free particle wave function

a=10; c1=pi*sqrt(2*a); h=(6.626/(2*pi))*10^-34; m=9.11*10^-31; X=-60:.1:60; t=m*a^2/h; V=zeros(1,201); for j=1:length(X) ...

How to plot the Free particle wave function

a=10; c1=pi*sqrt(2*a); h=(6.626/(2*pi))*10^-34; m=9.11*10^-31; X=-60:.1:60; t=m*a^2/h; V=zeros(1,201); for j=1:length(X) ...

16 días ago | 0

| accepted

Answered

Use Position Values to Keep Values in Matrix

Filled=Filling.*(cumsum(Volume<0,2)==1);

Use Position Values to Keep Values in Matrix

Filled=Filling.*(cumsum(Volume<0,2)==1);

16 días ago | 0

| accepted

Answered

How to find vector elements indices for the first and last locations of a specific number?

[~,idxfirst]=ismember(unique(A),A); [~,idxlast]=ismember(unique(A),flip(A)); idxlast=length(A)+1-idxlast;

How to find vector elements indices for the first and last locations of a specific number?

[~,idxfirst]=ismember(unique(A),A); [~,idxlast]=ismember(unique(A),flip(A)); idxlast=length(A)+1-idxlast;

16 días ago | 1

| accepted

Answered

How to fitt a power function to data

If you have the curve fitting toolbox. f=fit(x,y,'power1');

How to fitt a power function to data

If you have the curve fitting toolbox. f=fit(x,y,'power1');

16 días ago | 0

Answered

Return the value from a specific excel colomn/row

If you don't provide an example, we don't know what the format of lat/long/temp is in. They might be numbers or strings. a=read...

Return the value from a specific excel colomn/row

If you don't provide an example, we don't know what the format of lat/long/temp is in. They might be numbers or strings. a=read...

16 días ago | 0

Answered

Try to solve System of Linear Equations

A=[1 1;10 45;1 3;10 15]; b=[250;24000;3360;1440]; A\b

Try to solve System of Linear Equations

A=[1 1;10 45;1 3;10 15]; b=[250;24000;3360;1440]; A\b

17 días ago | 0