Answered
Find the intersection of a square pixel with a closed 2D curve
Doesn't consider below case (use intersect() if it matters to you): Only when nodes inside our outside (base on inpolygon()) ...

7 years ago | 1

Answered
Anyone have any tips to improve my code for findpeaks() so that I get only the first big peaks for each graph like those in transducers 10,13 and 1 but only one of them per graph? I want the first arrival time. Thanks.
If you want first peak use locs(1) If you want max peaks use max() If you want a few maximum peaks use sort() Did i understan...

7 years ago | 0

Answered
How to solve a system of two non-linear equations symbolically
Use matlabFunction() to make function handle from symboliv expression L0 = matlabFunction(L0); L1 = matlabFunction(L1); A = 0...

7 years ago | 0

Answered
Solving for ball trajectory with quadratic drag
'What I've noticed is that positions x,y,z don't even appear in my equations, so they are not used inside the function dxdt.' I...

7 years ago | 1

| accepted

Answered
Helping to create animated wrapping line on a torus
Read about surf() and meshgrid() to plot torus Simple example for animation (actually it's just drawing new object in time) Re...

7 years ago | 0

Answered
Aircraft wing fuel tank modelling
Another way: Calculate the volume of a tank at some control levels % schematic algorithm if V < V1 Y_fuel ...

7 years ago | 0

Answered
How to calculate the distance, in pixels, between each centroid in a binary image.
pdist2 finds distances between every point (every possible combinations. Zeros in matrix means distance to points themselves) ...

7 years ago | 1

Answered
How to find the boundary points in one direction
What if just find() indices where x > 0.95?

7 years ago | 1

| accepted

Answered
I know a certain y1 and I want to find the respective x1.
I'd use polyxpoly or intersections x = linspace(0,10,20); y = sin(x); y1 = 0.6; % find x at y=0.6 ...

7 years ago | 0

Answered
ode23 , matrix equation , 2nd order DE
You can find roots for x'', y'' and dtheta'' every iteration solving matrix equation function du = func(t,u) u1 = u(1:3)';...

7 years ago | 0

| accepted

Answered
How to connect lines in a skeletonized image with arcs
Use bwmorph() to find branch points. I sorted them in counter clock-wise order: Find distance and center between neighbor poi...

7 years ago | 0

Answered
Find the set of 3d data parrallel to the current 3d data
Choose some points (P1,P2,P3) from your data - vector of the first line (blue) - some temporary vector between P2 and P3 poi...

7 years ago | 0

| accepted

Answered
How do I select the pixels outside my region of interest?
m = size(I,1); % number of rows n = size(I,2); % number of columns R = 100; % radius region [X,Y] = meshgrid(...

7 years ago | 1

| accepted

Answered
How to avoid painting outside the figure using linewidth
Use axis([xmin xmax ymin ymax])

7 years ago | 0

Answered
How to get selected faces in a plotted 3D geometry
Try to change

7 years ago | 0

Answered
2DOF Harmonic Oscillator - Is this right? (How would I do this with ODE45?)
What about ode45? % x(1) == xs % x(2) == dxs % x(3) == xm % x(4) == dxm % fun = @(t,x) [ Vs; d2xs; Vm; d2xm ]; fun = @(t,x...

7 years ago | 0

Answered
Solving system of non linear equations of oscillating mechanism on ODE45
There is something wrong in your (3) equation. I'd first express (4), (5) and (6) like: And substitude it into (3): ...

7 years ago | 0

Answered
Calulate width of every boundary point to majorAxisLength
Just count pixels in vertical direction with sum() I = imread('image.png'); I1 = im2bw(I); % binary image h ...

7 years ago | 0

| accepted

Answered
How to simulate an ODE when one of the parameters is a function of time
Read how to Pass Extra Parameters in help ode23: sol = ode23(@(t,x)Eq(t,x,par),[0 Tfinal],x0); % solving the model Passing tra...

7 years ago | 0

Answered
Numerical integral over the whole spherical volume of a crystallite
Suggestion: Use integral or trapz

7 years ago | 1

Answered
Numerical integration with many parameters.
You forgot about element-wise operator delta=1-Mycp./100; Look also for VECTORIZE

7 years ago | 1

Answered
Why doesn't this code rotate and transform the spiral?
Because you have to mulptiply each set of point separately ptsNew = zeros(size(pts)); for i = 1:1000 ptsNew(:,i) = mTrans...

7 years ago | 0

Answered
how to calculate a ellipsoid arc and project it onto a plane?
I'd build a plane through 3 points (X,Y for plane surface and for ellipsoid surface must be the same) C = contour(X,Y,Zp-Zs,...

7 years ago | 0

Answered
Generate a multiplicative cascade process
Probably should think about initial m, w, z m = 0.2; z = rand; w = rand; syms x y = -x-z-w+1; eq = x^2+y^2+z^2+w^2 -m; ...

7 years ago | 0

| accepted

Answered
Heat map visualizing touch pressure on smartphone in x-y space
I did my best, please like it

7 years ago | 1

| accepted

Answered
solving a system of ODE
Function looks okay except f/u1. Has to be (as instruction says): ydot = [(ps - p)/d + ppval(f,t))/u1 ... Read about ode45. Ma...

7 years ago | 0

Answered
3D human body for temperature analysis
A lot of work has to be done clc,clear [x, y, z] = cylinder; surf(5*x,5*y,20*z*(1-0.5)) % main body hold on surf( z*7+2,x,...

7 years ago | 1

Answered
How can I plot elliptical pressure distribution
You mean surface or pcolor? [x,y] = meshgrid(-5:0.5:5); Pmax = (3*N)/(2*pi*a*b); pn = Pmax*sqrt(1-(x/a)^2-(y/b)^2); surf(x,y...

7 years ago | 1

| accepted

Answered
Distance difference from center
I did this xyz0 = (mean(xyz)+mean(abc))/2; % O point XYZ0 = repmat(xyz0,size(xyz,1),1); % duplicate...

7 years ago | 0

| accepted

Load more