Answered

Removing points from meshgrid (mask)

Try this simple script [X,Y] = meshgrid(1:20); n = [1 -1]; n = n/norm(n); % normal of a line dist = -7; ...

Removing points from meshgrid (mask)

Try this simple script [X,Y] = meshgrid(1:20); n = [1 -1]; n = n/norm(n); % normal of a line dist = -7; ...

ungefär 5 timmar ago | 0

Answered

How can I find the surface normal of a 8 by 3 matrix?

Use griddata to create a surface Use surfnorm to find normal vectors [nx,ny,nz] = surfnorm(x,y,z); surf(x,y,z) hold on quiv...

How can I find the surface normal of a 8 by 3 matrix?

Use griddata to create a surface Use surfnorm to find normal vectors [nx,ny,nz] = surfnorm(x,y,z); surf(x,y,z) hold on quiv...

ungefär 5 timmar ago | 0

Answered

How do I increase the circle size and animate a stick figure?

Use for loop and pause t = linspace(0,2*pi); x = cos(t); y = sin(t); axis([-10 10 -10 10]) hold on for i = 1:10 h = p...

How do I increase the circle size and animate a stick figure?

Use for loop and pause t = linspace(0,2*pi); x = cos(t); y = sin(t); axis([-10 10 -10 10]) hold on for i = 1:10 h = p...

ungefär 14 timmar ago | 0

Answered

Finding specific data point x for given y

I need to find the CB and CS values at t=5 Use interp1 to find i need to find the t and CB values when CS = 0.001 Use fsolve ...

Finding specific data point x for given y

I need to find the CB and CS values at t=5 Use interp1 to find i need to find the t and CB values when CS = 0.001 Use fsolve ...

ungefär 14 timmar ago | 0

Answered

Surface between 3D lines

You are concatenating in a wrong way XX = [D1 D1 D1]; YY = [F1 F2 F3]; ZZ = [z1 z2 z3]; surf(XX,ZZ,YY,'EdgeColor','none')

Surface between 3D lines

You are concatenating in a wrong way XX = [D1 D1 D1]; YY = [F1 F2 F3]; ZZ = [z1 z2 z3]; surf(XX,ZZ,YY,'EdgeColor','none')

ungefär 14 timmar ago | 0

Answered

two body problem using ode45

- equation of equilibrium Is this condition fullfield?

two body problem using ode45

- equation of equilibrium Is this condition fullfield?

en dag ago | 0

Answered

Numerically Integrating the differential equation below?

Any guidance on it is much appreciated! Helpfull page: ODE45 I do not know what I can do if I no tf. Try tf = 5. This should ...

Numerically Integrating the differential equation below?

Any guidance on it is much appreciated! Helpfull page: ODE45 I do not know what I can do if I no tf. Try tf = 5. This should ...

2 dagar ago | 0

Answered

Streamline plot not complete

Works ok for me N = 15; xx = linspace(min(x(:)),max(x(:)),10); yy = linspace(min(y(:)),max(y(:)),10); [startx,starty] = mes...

Streamline plot not complete

Works ok for me N = 15; xx = linspace(min(x(:)),max(x(:)),10); yy = linspace(min(y(:)),max(y(:)),10); [startx,starty] = mes...

3 dagar ago | 0

| accepted

Answered

2D Matrix revolution

Use cylinder for each curve separately: z = linspace(-1,1,20); % axis r = sqrt(1-z.^2); ...

2D Matrix revolution

Use cylinder for each curve separately: z = linspace(-1,1,20); % axis r = sqrt(1-z.^2); ...

3 dagar ago | 0

Answered

How do I align the vertices and the adjacency graph of a Buckyball?

Here is a way ind = full(B); % convert to ordinary matrix [rr,cc] = find(ind); % find non-zero elements ix = ...

How do I align the vertices and the adjacency graph of a Buckyball?

Here is a way ind = full(B); % convert to ordinary matrix [rr,cc] = find(ind); % find non-zero elements ix = ...

5 dagar ago | 0

Answered

Find the coordinates of a point chosen on a plot

Short example x = linspace(0,2,20)'; % generate some data y = sin(x); plot(x,y,'.-b') xy = ginput(1); ...

Find the coordinates of a point chosen on a plot

Short example x = linspace(0,2,20)'; % generate some data y = sin(x); plot(x,y,'.-b') xy = ginput(1); ...

7 dagar ago | 1

| accepted

Answered

How do I create a sphere without sphere function that will inflate like a balloon utilizing the getframe function?

Use surf to create a 3D surface rr = linspace(0,0.5,20); tt = linspace(0,2*pi,40); [R,T] = meshgrid(rr,tt); [X,Y] = pol2cart...

How do I create a sphere without sphere function that will inflate like a balloon utilizing the getframe function?

Use surf to create a 3D surface rr = linspace(0,0.5,20); tt = linspace(0,2*pi,40); [R,T] = meshgrid(rr,tt); [X,Y] = pol2cart...

9 dagar ago | 0

Answered

Differential Algebraic Equations with vectors

Try f = @(t,u) inv(Z)*(J+p*W*pi*Q)*[u(3) u(4)]' + inv(Z)*(V+p*W*pi*Q)*[u(1) u(2)]'; F = @(t,u) [u(3) u(4) ...

Differential Algebraic Equations with vectors

Try f = @(t,u) inv(Z)*(J+p*W*pi*Q)*[u(3) u(4)]' + inv(Z)*(V+p*W*pi*Q)*[u(1) u(2)]'; F = @(t,u) [u(3) u(4) ...

9 dagar ago | 1

| accepted

Answered

How to find the handle of all markers in plot (already made)?

To set up markerSize to every marker try: h = get(gca,'children'); for i = 1:length(h) if strcmp(get(h(i),'type'),'line')...

How to find the handle of all markers in plot (already made)?

To set up markerSize to every marker try: h = get(gca,'children'); for i = 1:length(h) if strcmp(get(h(i),'type'),'line')...

10 dagar ago | 0

| accepted

Answered

Ytick Spacing on Bode Plot Magnitude

If you are using subplot ax1 = subplot(211); plot(x1,y1) ax2 = sbuplot(212); plot(x1,y2); set(ax1,'YTick',[1 2 3]) set(a...

Ytick Spacing on Bode Plot Magnitude

If you are using subplot ax1 = subplot(211); plot(x1,y1) ax2 = sbuplot(212); plot(x1,y2); set(ax1,'YTick',[1 2 3]) set(a...

12 dagar ago | 0

Answered

How to plot a graph in simulated annealing code? How can we know the solution is near the true value?

How can I be confident that the solution is near the true value as the minimum value keeps changing when I run the code? Well, ...

How to plot a graph in simulated annealing code? How can we know the solution is near the true value?

How can I be confident that the solution is near the true value as the minimum value keeps changing when I run the code? Well, ...

12 dagar ago | 0

Answered

Using Runge Kutta function to solve Rossler equations

Write your f function as x'(t)=-x(t)-y(t) y'(t)=ax(t)+y(t) z'(t)=b+z(t)(x(t)-c) %where I fix parameters say c=5, b=3, a=0.2...

Using Runge Kutta function to solve Rossler equations

Write your f function as x'(t)=-x(t)-y(t) y'(t)=ax(t)+y(t) z'(t)=b+z(t)(x(t)-c) %where I fix parameters say c=5, b=3, a=0.2...

12 dagar ago | 1

| accepted

Answered

Complement of an Image using loop

Use this trick for i = 1:m % rows for j = 1: round(n/m*(m-i+1)) % columns I(i,j) = original; end ...

Complement of an Image using loop

Use this trick for i = 1:m % rows for j = 1: round(n/m*(m-i+1)) % columns I(i,j) = original; end ...

13 dagar ago | 0

Answered

Doubt in MATLAB program

Here is the problem Also you have y(1),y(2),y(3). It means that you have 3 initial condition values, also you should have 3 d...

Doubt in MATLAB program

Here is the problem Also you have y(1),y(2),y(3). It means that you have 3 initial condition values, also you should have 3 d...

13 dagar ago | 1

| accepted

Answered

How to find the center to contour angle in matlab

Use edge to detect contour find (x,y) coordinates (remember x - columns, y - rows) coordinates need to be sorted (hint: divide...

How to find the center to contour angle in matlab

Use edge to detect contour find (x,y) coordinates (remember x - columns, y - rows) coordinates need to be sorted (hint: divide...

13 dagar ago | 0

Answered

Max change in z within a certain radius of a point

Use logical conditions ix = (x-x0).^2 + (y-y0).^2 < 20^2; z(ix) % all z values around (x0,y0) r=20

Max change in z within a certain radius of a point

Use logical conditions ix = (x-x0).^2 + (y-y0).^2 < 20^2; z(ix) % all z values around (x0,y0) r=20

14 dagar ago | 0

Answered

exit from the cycle

Use break to exit loop 2) how to work with rows and columns The question is unclear. You can use 2 for loops for i = 1:size(A...

exit from the cycle

Use break to exit loop 2) how to work with rows and columns The question is unclear. You can use 2 for loops for i = 1:size(A...

14 dagar ago | 1

Answered

Get the Volume of Intersection Between Two 3D Shapes?

Use equations to get intersection lines: Integral can be used to calculate the volume (1/8 of the volume) and

Get the Volume of Intersection Between Two 3D Shapes?

Use equations to get intersection lines: Integral can be used to calculate the volume (1/8 of the volume) and

14 dagar ago | 0

Answered

Input formula to be used in a function

Use function handle function main f = @(x) 2*x + 1; % function handle func(f,2,3) function res = func(f,a...

Input formula to be used in a function

Use function handle function main f = @(x) 2*x + 1; % function handle func(f,2,3) function res = func(f,a...

14 dagar ago | 0

Answered

How can I color something in an image with a specific color?

Use this

How can I color something in an image with a specific color?

Use this

14 dagar ago | 0

| accepted

Answered

Edge detection when the boundaries are clearly marked

Try this: A = imread('test.jpeg'); subplot(1,2,1) imshow(A) RGB = [140 224 226]; % color you want (cyan) % RGB = [...

Edge detection when the boundaries are clearly marked

Try this: A = imread('test.jpeg'); subplot(1,2,1) imshow(A) RGB = [140 224 226]; % color you want (cyan) % RGB = [...

14 dagar ago | 0

Answered

calling gradient multiple times

It's because of calculation first and last point. gradient does it this way: first_grad = (y2-y1)/dx; second_grad = 1/2*(y4-y3...

calling gradient multiple times

It's because of calculation first and last point. gradient does it this way: first_grad = (y2-y1)/dx; second_grad = 1/2*(y4-y3...

15 dagar ago | 0

| accepted

Answered

Find the partial minimums in a set of values

Use findpeaks(-data) Choose peaks that lie in 23 < x < 27 and 58 < x < 62

Find the partial minimums in a set of values

Use findpeaks(-data) Choose peaks that lie in 23 < x < 27 and 58 < x < 62

15 dagar ago | 0

| accepted

Answered

Alternatives to Delaunay triangulation

Volume can be found as summation volume of pyramids. Here is an idea: clc,clear load Coords.txt x = Coords(:,1); y = Coo...

Alternatives to Delaunay triangulation

Volume can be found as summation volume of pyramids. Here is an idea: clc,clear load Coords.txt x = Coords(:,1); y = Coo...

15 dagar ago | 0