Answered

How to NOT share variable with nested function?

If you declare function or variable inside nested function it rewrites itself. There is no option for mistake function main a ...

How to NOT share variable with nested function?

If you declare function or variable inside nested function it rewrites itself. There is no option for mistake function main a ...

meer dan 3 jaar ago | 0

Answered

Rotate the centre plate in a geometry

You can rotate it using rotation matrix Or you can use rotate()

Rotate the centre plate in a geometry

You can rotate it using rotation matrix Or you can use rotate()

meer dan 3 jaar ago | 0

Answered

How to create a single gobjects for different plots to avoid using clf

Try this way x = 0:.2:10; y1 = x + nan; y2 = x + nan; h1 = plot(x,y1,'r'); h2 = line(x,y2); for i = 1:length(x) y1(i)...

How to create a single gobjects for different plots to avoid using clf

Try this way x = 0:.2:10; y1 = x + nan; y2 = x + nan; h1 = plot(x,y1,'r'); h2 = line(x,y2); for i = 1:length(x) y1(i)...

meer dan 3 jaar ago | 0

Answered

ODE 45 couldn't solve the differential equation.

Try this way psol = []; for k = 1:3 ode_ = @(z,Pp) (-ap + (((sca*nc)-(sac*na))*Tp*Nt(k)*Pp))'; psol = [psol; ode45(o...

ODE 45 couldn't solve the differential equation.

Try this way psol = []; for k = 1:3 ode_ = @(z,Pp) (-ap + (((sca*nc)-(sac*na))*Tp*Nt(k)*Pp))'; psol = [psol; ode45(o...

meer dan 3 jaar ago | 0

Answered

How can I change the line colour in a geoplot based on data?

Try set h1 = geoplot(..); set(h1,'color','r')

How can I change the line colour in a geoplot based on data?

Try set h1 = geoplot(..); set(h1,'color','r')

meer dan 3 jaar ago | 0

Answered

Ignoring certain matrix entries with surf plot

Don't use '==' equal sign for comparing double numbers ii = abs(MatrixName-0)<0.1; % precision MatrixName(ii) = NaN;

Ignoring certain matrix entries with surf plot

Don't use '==' equal sign for comparing double numbers ii = abs(MatrixName-0)<0.1; % precision MatrixName(ii) = NaN;

meer dan 3 jaar ago | 0

Answered

how can i let all number in matrix X between 0~1?

It's called scaling A1 = (A-min(A(:)))/(max(A(:))-min(A(:))) *1;

how can i let all number in matrix X between 0~1?

It's called scaling A1 = (A-min(A(:)))/(max(A(:))-min(A(:))) *1;

meer dan 3 jaar ago | 0

Answered

How to place/ define points on a triangulated meshed surface?

How about simple griddata with using initmesh t = 0:.2:5; x = [t; t]; % some data y = [t*0; t*0+3]; ...

How to place/ define points on a triangulated meshed surface?

How about simple griddata with using initmesh t = 0:.2:5; x = [t; t]; % some data y = [t*0; t*0+3]; ...

meer dan 3 jaar ago | 1

Answered

RK 6 method giving large errors

First of all you should rewrite your code to make more readable. The code is very difficult to to check. Make it as clear as pos...

RK 6 method giving large errors

First of all you should rewrite your code to make more readable. The code is very difficult to to check. Make it as clear as pos...

meer dan 3 jaar ago | 2

Answered

How to 3D plot eight 4x4 matrices to form a cuboid?

What about cylinder? r = sqrt(2); t = linspace(0,2*pi,5)+pi/4; z = [0 0 1 1]; [T,Z] = ndgrid(t,z); [X,Y] = pol2cart(T,r); ...

How to 3D plot eight 4x4 matrices to form a cuboid?

What about cylinder? r = sqrt(2); t = linspace(0,2*pi,5)+pi/4; z = [0 0 1 1]; [T,Z] = ndgrid(t,z); [X,Y] = pol2cart(T,r); ...

meer dan 3 jaar ago | 0

Answered

How can I do a spline interpolation with tangent continuity

What about this? I calculated tangent at each point and added points dx = 0.1; % adding points distan...

How can I do a spline interpolation with tangent continuity

What about this? I calculated tangent at each point and added points dx = 0.1; % adding points distan...

meer dan 3 jaar ago | 0

Answered

Get the percentage of dark spots

Use first matrix of an image (red channel) A0 = imread('image.png'); A1 = ~im2bw(A0,0.8); % select the stick A2 = A0(:...

Get the percentage of dark spots

Use first matrix of an image (red channel) A0 = imread('image.png'); A1 = ~im2bw(A0,0.8); % select the stick A2 = A0(:...

meer dan 3 jaar ago | 1

Answered

3D surface reconstruction from 2D image recorded through a prism

Try something like this: % [xw3,yw3,zw3] - 3D positions of white markers % [xw2, yw2] - 2D positions of white markers % [x...

3D surface reconstruction from 2D image recorded through a prism

Try something like this: % [xw3,yw3,zw3] - 3D positions of white markers % [xw2, yw2] - 2D positions of white markers % [x...

meer dan 3 jaar ago | 0

Answered

How to solve exceed number of array element (1) problem?

Here is the problem. You are redefining the variable inside for loop and it has (1) element again

How to solve exceed number of array element (1) problem?

Here is the problem. You are redefining the variable inside for loop and it has (1) element again

meer dan 3 jaar ago | 0

| accepted

Answered

Results are NaN or absurd if a certain parameter changes.

I suggest you to visualize the data in 3D. See how values change each step T = zeros(20); a = 0.04; % consta...

Results are NaN or absurd if a certain parameter changes.

I suggest you to visualize the data in 3D. See how values change each step T = zeros(20); a = 0.04; % consta...

meer dan 3 jaar ago | 0

Answered

How to calculate an area with obtained nodes?

An example of boundary function. polyarea is used to calculate area r = 1; x = linspace(-1,1,20); y = sqrt(r^2 - x.^2); x = ...

How to calculate an area with obtained nodes?

An example of boundary function. polyarea is used to calculate area r = 1; x = linspace(-1,1,20); y = sqrt(r^2 - x.^2); x = ...

meer dan 3 jaar ago | 0

| accepted

Answered

How to count white pixels in Watershed segmented image?

Here is an example with using bwlabel A = zeros(100); t = linspace(0,2*pi,1000); % a lot of points [x,y] = pol2cart(t,1)...

How to count white pixels in Watershed segmented image?

Here is an example with using bwlabel A = zeros(100); t = linspace(0,2*pi,1000); % a lot of points [x,y] = pol2cart(t,1)...

meer dan 3 jaar ago | 0

Answered

aligning data for fprintf

Here is ax example a = rand(10,1)*1e4; sprintf('a = %7.2f\n',a')

aligning data for fprintf

Here is ax example a = rand(10,1)*1e4; sprintf('a = %7.2f\n',a')

meer dan 3 jaar ago | 0

| accepted

Answered

Plot a sine wave with decreasing frequency over time

Modify x coordinate x = 0:.1:30; y = sin(x); x1 = x - 10*(x/max(x)).^2; % shift last point 10 units plot(x1,y)

Plot a sine wave with decreasing frequency over time

Modify x coordinate x = 0:.1:30; y = sin(x); x1 = x - 10*(x/max(x)).^2; % shift last point 10 units plot(x1,y)

meer dan 3 jaar ago | 0

Answered

Simulate a dot moving in an ellipse

Use pause() t = linspace(0,2*pi,20); x = 5*cos(t); y = 3*sin(t); h = plot(5,0,'.r'); line(x,y) for i = 1:20 set(h,'xd...

Simulate a dot moving in an ellipse

Use pause() t = linspace(0,2*pi,20); x = 5*cos(t); y = 3*sin(t); h = plot(5,0,'.r'); line(x,y) for i = 1:20 set(h,'xd...

meer dan 3 jaar ago | 1

| accepted

Answered

I want to find the value of two constants from an equation with two variables

Try fit

I want to find the value of two constants from an equation with two variables

Try fit

meer dan 3 jaar ago | 1

Answered

Estrarre l'intervallo di dati impostando il valore sulla matrice

Use griddata to interpolate the data Use slice to create slices

Estrarre l'intervallo di dati impostando il valore sulla matrice

Use griddata to interpolate the data Use slice to create slices

meer dan 3 jaar ago | 1

Answered

How can I condense a larger matrix into a smaller matrix based on elements of a vector?

Read about mat2cell

How can I condense a larger matrix into a smaller matrix based on elements of a vector?

Read about mat2cell

meer dan 3 jaar ago | 0

Answered

Is there anyway to Re-grid one dataset to another dataset resolution without interpolating??

Maybe this A = ones(3,3); B = [A;nan(6,3)]; C = reshape(B,3,[])

Is there anyway to Re-grid one dataset to another dataset resolution without interpolating??

Maybe this A = ones(3,3); B = [A;nan(6,3)]; C = reshape(B,3,[])

meer dan 3 jaar ago | 0

Answered

How can i draw graphene first brillouin zone using matlab?

Here is ax example t = linspace(0,2*pi,7); [x,y] = pol2cart(t,3); surf([x;x],[y;y],[x*0;x*0+1],'facecolor','none') axis equa...

How can i draw graphene first brillouin zone using matlab?

Here is ax example t = linspace(0,2*pi,7); [x,y] = pol2cart(t,3); surf([x;x],[y;y],[x*0;x*0+1],'facecolor','none') axis equa...

meer dan 3 jaar ago | 0

| accepted

Answered

Need to access the structure values in numerical form and store it in an array each time the loop runs

Make some modifications An example syms x y sol = solve([5*x-y y-1])

Need to access the structure values in numerical form and store it in an array each time the loop runs

Make some modifications An example syms x y sol = solve([5*x-y y-1])

meer dan 3 jaar ago | 1

| accepted

Answered

How to compare solution of ODE for each time step?

Maybe you are looking for event option. Then just place ode45 insife while loop t0 = 1; while contdition [t,x] = ode45(f,...

How to compare solution of ODE for each time step?

Maybe you are looking for event option. Then just place ode45 insife while loop t0 = 1; while contdition [t,x] = ode45(f,...

meer dan 3 jaar ago | 0

Answered

How to integrate the indices of a vector of doubles?

Sure t = linspace(0,1,12054); S = trapz(t,AT);

How to integrate the indices of a vector of doubles?

Sure t = linspace(0,1,12054); S = trapz(t,AT);

meer dan 3 jaar ago | 0

| accepted

Answered

trying to use integral transform to multiple large arrays but getting an error about array being too large to calculate

Maybe you need just interpolate the data to make the same size % x data with 88000 elements t1 = linspace(1,88000,15001); ...

trying to use integral transform to multiple large arrays but getting an error about array being too large to calculate

Maybe you need just interpolate the data to make the same size % x data with 88000 elements t1 = linspace(1,88000,15001); ...

meer dan 3 jaar ago | 0