Answered

Use a different colormap scale for different sections of a matrix

YOu can create your own color matrix [x,y,z] = peaks(30); ix = x.^2 + y.^2 < 2^2; c1 = z*0; c2 = z*0; c1(ix) = 1; c2(~ix) ...

Use a different colormap scale for different sections of a matrix

YOu can create your own color matrix [x,y,z] = peaks(30); ix = x.^2 + y.^2 < 2^2; c1 = z*0; c2 = z*0; c1(ix) = 1; c2(~ix) ...

12 days ago | 0

Answered

Medial axis extraction from a .STL file

An example [x,y,z] = cylinder(10); h = surf(x,y,z); p = surf2patch(h,'triangle'); p.facecolor = 'red'; stlwrite('test',p) ...

Medial axis extraction from a .STL file

An example [x,y,z] = cylinder(10); h = surf(x,y,z); p = surf2patch(h,'triangle'); p.facecolor = 'red'; stlwrite('test',p) ...

12 days ago | 0

Answered

Solving Population Balance Equation for multiple initial particle dimensions

First of all - timespan 0:1.2 is just [0 1] L=[1.2]; % Pipe Length ranges (m) [Z,N]=ode15s(...

Solving Population Balance Equation for multiple initial particle dimensions

First of all - timespan 0:1.2 is just [0 1] L=[1.2]; % Pipe Length ranges (m) [Z,N]=ode15s(...

12 days ago | 1

Answered

how to add titles row wise in the montage ?

What about text function? load mri montage(D, map) text(500,25,'TITLE 1','fontsize',30,'color','yellow','fontweight','bold') ...

how to add titles row wise in the montage ?

What about text function? load mri montage(D, map) text(500,25,'TITLE 1','fontsize',30,'color','yellow','fontweight','bold') ...

12 days ago | 0

| accepted

Answered

Plot in 300 or 600 dpi

Use print x = 0:10; y = sin(x); plot(x,y); print('test','-dpng','-r300')

Plot in 300 or 600 dpi

Use print x = 0:10; y = sin(x); plot(x,y); print('test','-dpng','-r300')

12 days ago | 1

| accepted

Answered

Plotting dates on the x-axis

Just use datenum a = rand(5,4,3); datenum(a(:,1),a(:,2),a(:,3)) Use sort if needed

Plotting dates on the x-axis

Just use datenum a = rand(5,4,3); datenum(a(:,1),a(:,2),a(:,3)) Use sort if needed

12 days ago | 0

Answered

Solve an equation, for a variable, with prompts?

What about this? function main a = myprompt('Please enter a:'); b = myprompt('the same way b:'); function y = myprompt(s...

Solve an equation, for a variable, with prompts?

What about this? function main a = myprompt('Please enter a:'); b = myprompt('the same way b:'); function y = myprompt(s...

12 days ago | 0

Answered

Looping of more than one first order equations in in function file that can be updated for different value variable parameter

See this example f = @(t,x,a) [x(2); x(1)-a*sin(x(1))]; a = rand(10,1); % parameter cmap = jet(10); for i = 1:length(a)...

Looping of more than one first order equations in in function file that can be updated for different value variable parameter

See this example f = @(t,x,a) [x(2); x(1)-a*sin(x(1))]; a = rand(10,1); % parameter cmap = jet(10); for i = 1:length(a)...

12 days ago | 0

| accepted

Answered

How do I print probability distribution object into textbox?

Here pd = makedist('Normal'); sig1 = pd.sigma mu1 = pd.mu

How do I print probability distribution object into textbox?

Here pd = makedist('Normal'); sig1 = pd.sigma mu1 = pd.mu

12 days ago | 1

Answered

solving equations with trigonometric functions

Here is the similar example. Maybe you will be interested , , and length are given. angle is changing Calculate length and...

solving equations with trigonometric functions

Here is the similar example. Maybe you will be interested , , and length are given. angle is changing Calculate length and...

12 days ago | 0

Answered

How to get back the values of a curve from its cumulative integral value?

Use diff to find real curve from cumulative trapezoid result

How to get back the values of a curve from its cumulative integral value?

Use diff to find real curve from cumulative trapezoid result

13 days ago | 0

| accepted

Answered

How to convert from surf to plot3 ?

Try meshgrid [X1,Y1] = meshgrid(X,Y); plot3(X1,Y1,Z1) line(X1',Y1',Z1')

How to convert from surf to plot3 ?

Try meshgrid [X1,Y1] = meshgrid(X,Y); plot3(X1,Y1,Z1) line(X1',Y1',Z1')

13 days ago | 1

| accepted

Answered

How do I create variable vectors with a new value for each iteration of a loop?

Here are some corrections % yp=y0; % you are replacing variable yp with y0 yp(1) = y0; % you need to replace first valu...

How do I create variable vectors with a new value for each iteration of a loop?

Here are some corrections % yp=y0; % you are replacing variable yp with y0 yp(1) = y0; % you need to replace first valu...

13 days ago | 0

| accepted

Answered

Measure distance and angle of object

Here is the algorithm crop the region 1 and find min/max [m,n] = size(step1); [~,x1] = find(step1(:,1:n/2),1,'last'); [~,x2...

Measure distance and angle of object

Here is the algorithm crop the region 1 and find min/max [m,n] = size(step1); [~,x1] = find(step1(:,1:n/2),1,'last'); [~,x2...

13 days ago | 0

| accepted

Answered

how to compute derivative

Only you know initial conditions. Imagine the situation: you are throwing the ball, initial conditions are velocity and angle. O...

how to compute derivative

Only you know initial conditions. Imagine the situation: you are throwing the ball, initial conditions are velocity and angle. O...

13 days ago | 1

| accepted

Answered

Plotting Convergence Graph from Bisection Method

Try this while %condition % code line(iter,erorr,'marker','.') iter = iter + 1; end

Plotting Convergence Graph from Bisection Method

Try this while %condition % code line(iter,erorr,'marker','.') iter = iter + 1; end

13 days ago | 0

Answered

How to generate straight lines to 2D target points, each straight line is connected by 10 points which represent 10 steps from (0,0) to target point, for example (5,6)?

What about this x = rand(20,1); y = rand(20,1); line([x x*0]',[y y*0]')

How to generate straight lines to 2D target points, each straight line is connected by 10 points which represent 10 steps from (0,0) to target point, for example (5,6)?

What about this x = rand(20,1); y = rand(20,1); line([x x*0]',[y y*0]')

14 days ago | 0

| accepted

Answered

How to detect a curve (surface roughness) from image?

binarize image first remove noise using bwareaopen use edge remove noise if needed using bwareaopen

How to detect a curve (surface roughness) from image?

binarize image first remove noise using bwareaopen use edge remove noise if needed using bwareaopen

14 days ago | 1

| accepted

Answered

Having trouble making a surface plot using data from Excel

Either use triangulation x = rand(20,1); y = rand(20,1); z = rand(20,1); dt = delaunay(x,y); trisurf(dt,x,y,z) Either gr...

Having trouble making a surface plot using data from Excel

Either use triangulation x = rand(20,1); y = rand(20,1); z = rand(20,1); dt = delaunay(x,y); trisurf(dt,x,y,z) Either gr...

14 days ago | 0

Answered

How can I use the subplot command to plot the root estimates vs iterations and the error vs iterations

Try this figure hold on while %condition % some code subplot(2,1,1) plot(iter,root) subplot(2,1,2) p...

How can I use the subplot command to plot the root estimates vs iterations and the error vs iterations

Try this figure hold on while %condition % some code subplot(2,1,1) plot(iter,root) subplot(2,1,2) p...

14 days ago | 0

Answered

Integrating a function with one of the limits a matrix

Why don't just use for loop? integralCalculated = zeros(size(u)); for i = 1:length(u) integralCalculated(i) = integral(@(...

Integrating a function with one of the limits a matrix

Why don't just use for loop? integralCalculated = zeros(size(u)); for i = 1:length(u) integralCalculated(i) = integral(@(...

14 days ago | 0

| accepted

Answered

Evaluating polynomial functions to get integer as answer

solve can be used for simple problems. Use fsolve or vpasolve to get numerical results

Evaluating polynomial functions to get integer as answer

solve can be used for simple problems. Use fsolve or vpasolve to get numerical results

14 days ago | 1

Answered

How to calculate area under each peak in plot from sampled data

Here is ax example x = 0:20; y = sin(x); [xc,yc] = polyxpoly(x,y,[0 20],[0 0]); % find '0' points intersections x1 = [x...

How to calculate area under each peak in plot from sampled data

Here is ax example x = 0:20; y = sin(x); [xc,yc] = polyxpoly(x,y,[0 20],[0 0]); % find '0' points intersections x1 = [x...

15 days ago | 0

Answered

Triangulation of a domain

Here is ax example of triangulation t = (0:90:270)+45; [x,y] = pol2cart(t*pi/180,1); gd = [2;length(x);x(:);y(:)]; % geomet...

Triangulation of a domain

Here is ax example of triangulation t = (0:90:270)+45; [x,y] = pol2cart(t*pi/180,1); gd = [2;length(x);x(:);y(:)]; % geomet...

15 days ago | 1

| accepted

Answered

empty figure for a given code

You forgot the dot (element-wise operator) You can simplify your code using for loop a0 = 1; for i = 1:5 a0 = ((a0*K-a...

empty figure for a given code

You forgot the dot (element-wise operator) You can simplify your code using for loop a0 = 1; for i = 1:5 a0 = ((a0*K-a...

15 days ago | 1

Answered

Filling in a spherical triangle

clc,clear t = [0; 45; 45]*pi/180; q = [45; 45; 90]*pi/180; [x,y,z] = sph2cart([t;t(1)],[q;q(1)],1); % convert angl...

Filling in a spherical triangle

clc,clear t = [0; 45; 45]*pi/180; q = [45; 45; 90]*pi/180; [x,y,z] = sph2cart([t;t(1)],[q;q(1)],1); % convert angl...

15 days ago | 0

Answered

How to create custom color wheel for velocity data stored as RGB and only using R/G channels?

What about this? [R,G] = ndgrid(0:10:360,0:1); % polar coordinates [X,Y] = pol2cart(R*pi/180,G); % convefrt o cart...

How to create custom color wheel for velocity data stored as RGB and only using R/G channels?

What about this? [R,G] = ndgrid(0:10:360,0:1); % polar coordinates [X,Y] = pol2cart(R*pi/180,G); % convefrt o cart...

15 days ago | 0

| accepted

Answered

i want to draw a streamline at 45 degree.

clc,clear [t,r] = ndgrid(0:5:45,0:10); % create mesh in polar coordinates [x,y] = pol2cart(t*pi/180,r); % con...

i want to draw a streamline at 45 degree.

clc,clear [t,r] = ndgrid(0:5:45,0:10); % create mesh in polar coordinates [x,y] = pol2cart(t*pi/180,r); % con...

15 days ago | 0

| accepted

Answered

How to get all yellow piexels that interact with the blue piexels?

What about contour? [m,n] = size(data); [x,y] = meshgrid(1:m,1:n); [C,h] = contour(x,y,data,[0.9 0.9]); h1 = get(h,'children...

How to get all yellow piexels that interact with the blue piexels?

What about contour? [m,n] = size(data); [x,y] = meshgrid(1:m,1:n); [C,h] = contour(x,y,data,[0.9 0.9]); h1 = get(h,'children...

15 days ago | 0

Answered

Compute x and y by integrating the ODE system using Huen's method.

You should use for loop function [x,y] = odeHuen (f,x0,h,nSteps,y0) % Initialize the output solution arrays. m = length(y0);...

Compute x and y by integrating the ODE system using Huen's method.

You should use for loop function [x,y] = odeHuen (f,x0,h,nSteps,y0) % Initialize the output solution arrays. m = length(y0);...

15 days ago | 0