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) ...

28日 前 | 1

| 採用済み

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')...

29日 前 | 0

| 採用済み

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...

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, ...

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...

| 採用済み

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 ...

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...

| 採用済み

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...

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

find the first change and its position
Use diff and find

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...

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

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...

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

| 採用済み

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 = [...

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...

| 採用済み

Find the partial minimums in a set of values
Use findpeaks(-data) Choose peaks that lie in 23 < x < 27 and 58 < x < 62

| 採用済み

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...

How can I change the degree symbol in axis tick label while using axesm function?
If you type something like: h = get(gca,'children'); >> get(h(2),'string') You will see that each label has "^" symbol ans =...

| 採用済み

How to make a round bounday on the object
Use edge to detect edge Use find to get coordinates (rows and columns of edge) Calculate some center (approximately) Use ca...

For loops for 2 variables. (Trajectory)
Piece of a code n = 10; theta2 = linspace(10,90,n); vi = linspace(0,vMAX,n); for i = 1:n % Velocity components...

| 採用済み

Crop an image using coordinates
Here is an attempt clc,clear I = imread('Capture.jpeg'); I1 = im2bw(I); % convert to binary I2 = bwareaop...

Guess number game and hint
Use abs function if abs(answer-guess) <= 5 disp('you are close!') end

| 採用済み

Matlab code for Poisson Boltzmann equation

| 採用済み

Plotting a 3D contour graph
Example with interp2 load matlab.mat Z = fv_avg_condensed; [m,n] = size(Z); [X,Y] = meshgrid(1:n,1:m); [Xq,Yq] = meshgr...

| 採用済み

Simulation of tensile test
An example clc,clear % umaxa=163; umaxa=113; umaxb=167; n = 20; area=0.064; rng('shuffle') Umax=umaxa + (umaxb-umaxa)....

convert pattern image to sinusoidal wave
Convert image (rgb2gray) and sum rows

The differential equation problem with variable solution by using ode45
Here is an idea [t1,x1] = ode45(@F1,ts,x0); % solve second order [t2,s] = ode45(@(t,s)F2(t,s,t1,x1(:,1)...

| 採用済み

How to visualize a tubular volume/surface passing through a given scalar data (points in 3D) forming a sequence of cross-sections
Here is one way: Interpolate each crossection with equal number of points (look HERE) Concantenate them and just use surf to...

| 採用済み

Brake rotor simulation - Couldn't get results
I set up maxstep opt = odeset('MaxStep',0.1); [t,x] = ode45(@DerFun,Tspan,x0,opt); And now it looks like

| 採用済み