Answered

Remove array values with multiple occurances from "parent" array

a = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]; b = [1, 1, 2, 4, 4, 4]; c = a; for i=b c(find(c==i,1))=[]; end

Remove array values with multiple occurances from "parent" array

a = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]; b = [1, 1, 2, 4, 4, 4]; c = a; for i=b c(find(c==i,1))=[]; end

1 month ago | 0

| accepted

Answered

Sum of a Series, Help!

Not sure exactly what you are asking. x=0:.1:10; for n=1:3 S(n,:)=arrayfun(@(i)sum(repmat(-1,1,n+1).^(0:n)./(2*(0:n)+1).*...

Sum of a Series, Help!

Not sure exactly what you are asking. x=0:.1:10; for n=1:3 S(n,:)=arrayfun(@(i)sum(repmat(-1,1,n+1).^(0:n)./(2*(0:n)+1).*...

1 month ago | 0

Answered

Finding equal values in two matrices and create a new matrix

A1 = importdata('Particles.txt'); A2 = importdata('Fragments.txt'); ID_Particles = A1(:,2); MID_Fragments = A2(:,6); CooPart...

Finding equal values in two matrices and create a new matrix

A1 = importdata('Particles.txt'); A2 = importdata('Fragments.txt'); ID_Particles = A1(:,2); MID_Fragments = A2(:,6); CooPart...

1 month ago | 0

| accepted

Answered

Bit xor of two binary strings and conversion into decimal

Use java BigInteger import java.math.*; a=BigInteger(str1,2); b=BigInteger(str2,2); c=a.xor(b);%c will be the decimal BigInt...

Bit xor of two binary strings and conversion into decimal

Use java BigInteger import java.math.*; a=BigInteger(str1,2); b=BigInteger(str2,2); c=a.xor(b);%c will be the decimal BigInt...

2 months ago | 0

Answered

Replacing row in matrix with previous row depending on condition

If you have consecutive rows containing -2, you will have to repeat until all the -2 rows have been replaced if that is your goa...

Replacing row in matrix with previous row depending on condition

If you have consecutive rows containing -2, you will have to repeat until all the -2 rows have been replaced if that is your goa...

2 months ago | 1

Answered

How do I replace values in a 400x400 matrix with values of 1x1001 array (r) and then replace all r <= 0.02 with 1 and r>0.02 with 0?

r=.0001:.0001:.1001; k=randi(1001,400);%I assumne you want randomly generated m=r(k); M=zeros(400); M(m<=.02)=1; M(m>.02)=0...

How do I replace values in a 400x400 matrix with values of 1x1001 array (r) and then replace all r <= 0.02 with 1 and r>0.02 with 0?

r=.0001:.0001:.1001; k=randi(1001,400);%I assumne you want randomly generated m=r(k); M=zeros(400); M(m<=.02)=1; M(m>.02)=0...

2 months ago | 0

| accepted

Answered

How to solve Index in position 1 exceeds array bounds (must not exceed 1).

You could always store it as a vector in the size you need it. p0_A_SOEC_INIT_out=p0_A_SOEC_INIT_out*ones(1,size_you_need);

How to solve Index in position 1 exceeds array bounds (must not exceed 1).

You could always store it as a vector in the size you need it. p0_A_SOEC_INIT_out=p0_A_SOEC_INIT_out*ones(1,size_you_need);

2 months ago | 0

| accepted

Answered

Array \ Matrix Output display formating

You could also round(x, 3) and use format shortG format shortG; syms phi M=exp(pi*tand(phi))*(tand(45+phi/2))^2; phi=10:0.5:...

Array \ Matrix Output display formating

You could also round(x, 3) and use format shortG format shortG; syms phi M=exp(pi*tand(phi))*(tand(45+phi/2))^2; phi=10:0.5:...

2 months ago | 1

| accepted

Answered

Extract rows in a Matrix based on column values of another Matrix.

count=1; for k=p a=find(q(:,1)==k);%assume there is only one match if ~isempty(a) newMatrix(count,:)=q(a,:);...

Extract rows in a Matrix based on column values of another Matrix.

count=1; for k=p a=find(q(:,1)==k);%assume there is only one match if ~isempty(a) newMatrix(count,:)=q(a,:);...

2 months ago | 0

Answered

slopes of a graph

Derivative of the data provide the slope. You could fit the data first before taking the derivative. You will have to decide. s...

slopes of a graph

Derivative of the data provide the slope. You could fit the data first before taking the derivative. You will have to decide. s...

2 months ago | 0

Answered

Why doesnÂ´t it stop the loop?

use break instead. You should never try to change the loop variable. break;

Why doesnÂ´t it stop the loop?

use break instead. You should never try to change the loop variable. break;

2 months ago | 1

| accepted

Answered

Reshaping a complex 3D array into 1D, and back

1dwave=3dwave(:)'; recovered_wave=reshape(1dwave,size(3dwave));

Reshaping a complex 3D array into 1D, and back

1dwave=3dwave(:)'; recovered_wave=reshape(1dwave,size(3dwave));

2 months ago | 0

Answered

how to write this

If u and t are just scalar 9*u*(t-2); If u and t are arrays or matrices of the same size 9*u.*(t-2);

how to write this

If u and t are just scalar 9*u*(t-2); If u and t are arrays or matrices of the same size 9*u.*(t-2);

2 months ago | 0

Answered

Double interpolation using lookup tables in matlab

[x,y]=meshgrid(25:5:50,-10:5:15); z=[59 76 91 107 122 137;78 98 116 133 149 164;101 127 148 167 184 197;127 155 177 197 214 227...

Double interpolation using lookup tables in matlab

[x,y]=meshgrid(25:5:50,-10:5:15); z=[59 76 91 107 122 137;78 98 116 133 149 164;101 127 148 167 184 197;127 155 177 197 214 227...

2 months ago | 0

| accepted

Answered

creating a signal without an IF statement

signal(find(fastMA>slowMA & rsi10mins < 65,1):find(fastMA<slowMA & rsi10mins > 35,1)-1) = 1;

creating a signal without an IF statement

signal(find(fastMA>slowMA & rsi10mins < 65,1):find(fastMA<slowMA & rsi10mins > 35,1)-1) = 1;

2 months ago | 0

Answered

using nested loop function to create a matrix

You can watch the 1's being filled in: s=10; H=zeros(s); J=zeros(s); for k=1:s for m=1:s H(k,m)=1;%simple doub...

using nested loop function to create a matrix

You can watch the 1's being filled in: s=10; H=zeros(s); J=zeros(s); for k=1:s for m=1:s H(k,m)=1;%simple doub...

2 months ago | 0

| accepted

Answered

Create Symbolic functions with existing function file

It should work, you just need to pass a symbolic z to the function. It would help in the future if you created code that we coul...

Create Symbolic functions with existing function file

It should work, you just need to pass a symbolic z to the function. It would help in the future if you created code that we coul...

2 months ago | 0

| accepted

Answered

Random display of 1 out of several images

You could read all the images into a cell array (each image in an element), then: for k=1:8 imageCell{k}=imread([num2str(k...

Random display of 1 out of several images

You could read all the images into a cell array (each image in an element), then: for k=1:8 imageCell{k}=imread([num2str(k...

2 months ago | 1

| accepted

Answered

The following error occurred converting from sym to double: Unable to convert expression into double array.

Do you have to perform symbolically? Does not look like the integral exists. Why not numerically? function f= myf2(w,k) dfm =@...

The following error occurred converting from sym to double: Unable to convert expression into double array.

Do you have to perform symbolically? Does not look like the integral exists. Why not numerically? function f= myf2(w,k) dfm =@...

2 months ago | 0

| accepted

Answered

Creating a Bell Curve of Data

Just looking at your data, histogram() function is useful. histogram(tmax01,30);%however many bins you want You could overlay:...

Creating a Bell Curve of Data

Just looking at your data, histogram() function is useful. histogram(tmax01,30);%however many bins you want You could overlay:...

2 months ago | 0

| accepted

Answered

Help with Viewing Table Contents

It is a .m file. All you have to do is: load('FloObsWindTable'); It will be in your work space. Double click on it and navigat...

Help with Viewing Table Contents

It is a .m file. All you have to do is: load('FloObsWindTable'); It will be in your work space. Double click on it and navigat...

2 months ago | 0

| accepted

Answered

Numerical Differentiation that returns column vector

If the time interval is constant (.005 between readings), it should be as simple as: thetadot=diff(theta1inv)/.005; You will g...

Numerical Differentiation that returns column vector

If the time interval is constant (.005 between readings), it should be as simple as: thetadot=diff(theta1inv)/.005; You will g...

2 months ago | 0

Answered

readmatrix is truncating and moving decimal

Are you sure there is not a times 1e5 somewhere before the matrix is displayed. The numbers are likely the same but the format i...

readmatrix is truncating and moving decimal

Are you sure there is not a times 1e5 somewhere before the matrix is displayed. The numbers are likely the same but the format i...

2 months ago | 1

Solved

Basics - not so easy division

Please make a function whcih divides x/y, but pay attention for some exceptions with NaN,0,Inf. Sometimes return "ERROR" instead...

2 months ago

Answered

Root of a complex function

It seens relatively straight forward to solve by brute force. Just keep running while reducing the step size of T until you get ...

Root of a complex function

It seens relatively straight forward to solve by brute force. Just keep running while reducing the step size of T until you get ...

2 months ago | 1

Answered

How to make a trajectory from position and Velocity data

newVariable=[eulerAngles(:,2)';gyr(:,2)'];

How to make a trajectory from position and Velocity data

newVariable=[eulerAngles(:,2)';gyr(:,2)'];

2 months ago | 0

| accepted

Answered

Concatenate Results from Function

apples=1:1:5; bananas=10:1:15; c=1; for a=1:numel(apples) for b=1:numel(bananas) [lions(c),tigers(c),bears(c)]=...

Concatenate Results from Function

apples=1:1:5; bananas=10:1:15; c=1; for a=1:numel(apples) for b=1:numel(bananas) [lions(c),tigers(c),bears(c)]=...

2 months ago | 0

| accepted

Answered

linear fit in Log Scale + extension

ind = f>=5000& f <= 10000 p = polyfit(f(ind),qU(ind),1);%you will always get a line if degree is 1 x=5000:15000; t = polyva...

linear fit in Log Scale + extension

ind = f>=5000& f <= 10000 p = polyfit(f(ind),qU(ind),1);%you will always get a line if degree is 1 x=5000:15000; t = polyva...

2 months ago | 1

| accepted

Answered

Velocity of a Weather Balloon

I will give you a start: syms t; v=-0.25*t.^3 + 36*t.^2 - 760*t + 4100; s=int(v)+9; a=diff(v); ezplot(s,[0,155.7]); figure...

Velocity of a Weather Balloon

I will give you a start: syms t; v=-0.25*t.^3 + 36*t.^2 - 760*t + 4100; s=int(v)+9; a=diff(v); ezplot(s,[0,155.7]); figure...

2 months ago | 0

| accepted