Answered
Plotting chemical 2d reaction in different colors
What about alpha? Try to set transparency to your object and then just plot them together [X1,Y1,Z1] = peaks(20); [X2,Y2] = me...

6 years ago | 1

Answered
For loop that extracts non constant values from a column in an Excel table and outputs the desried value of the selcted row
Use logical operators for this purpose num = xlsread('Testing.xlsx'); tbl = num ; col_2 = tbl(:,2); % Column of values val...

6 years ago | 0

| accepted

Answered
ode45 change function index when something happends
Try persistent variable function main clc % clear command window clear functions % clear persiste...

6 years ago | 0

| accepted

Answered
Surface plot with custom data tip
Use griddata to interpolate your data xx = linspace(min(X),max(X),20); yy = linspace(min(Y),max(Y),20); [X1,Y1] = meshgrid(xx...

6 years ago | 0

Answered
Simulating lots of non-interacting particles bouncing around in a 2D box
Here are some notes you can make your code shorter Didn't you forgot about timestep? Use this part of code to check if so...

6 years ago | 0

Answered
How to draw a tangent line to the curve?(tangent line has to pass through origin)
Here is the success condition: Numerical approach dx = 0.1; f1 = @(x0) (interp1(x,y,x0+dx) - interp1(x,y,x0))/dx; f2 = @...

6 years ago | 0

Answered
MATLAB Count multiple spheres with overlaps, known number of pixels per sphere, no 3D data available
How to know if sphere are too close? Try to separate them using imdilate I = imread('img1.png'); I1 = im2bw(I); se = strel('d...

6 years ago | 0

Answered
Contour map to show ocean depth
Use griddata % lat, long, depth - your data [LAT,LON] = meshgrid(lat,long); % create 2D matrices DP = griddata(lat,lo...

6 years ago | 1

| accepted

Answered
Plotting Inclined Rankine Oval
Here is a formula And this is how surface looks like originally Here is the problem part My suggestion is to plot only...

6 years ago | 0

Answered
How do I apply a tolerance to my code
Use this trick

6 years ago | 0

| accepted

Answered
Find the time of each collision on a wall of a ball in a 2d box.
See this simple example clear, clc vx = 10*cosd(-30); vy = 10*sind(-30); g = 9.81; % gravity x = 5; % start x y =...

6 years ago | 0

Answered
How to define a system of differential equations with three variables and calculate their variation with time?
Since your matrices are of 3x3 size the result should be of 3x1 size function dydt = dynamics(t,y,Mt,Ct,Kt) dydt = zeros(6,1);...

6 years ago | 0

| accepted

Answered
how to increase getframe dimensions and quality ?
Try this madness clc,clear,cla wobj = VideoWriter('test1.avi'); wobj.FrameRate = 10; % frames per second (vi...

6 years ago | 4

Answered
Help with a script that calculates bending moment of cantilever beam.
I think you are overcomplicated. Look on this idea

6 years ago | 0

Answered
reshape a photo to 8*8 blocks
Use mat2cell [m,n] = size(img); im = 8*ones(1,m/8); in = 8*ones(1,n/8); img1 = mat2cell(img,im,in); img2 = cat(3,img1{:});

6 years ago | 1

| accepted

Answered
How to replace data a specific portion of data within a column of different dimensions?
Here is a trick A1 = load('data1.txt'); A2 = load('data2.txt'); ix = 410:459; A1(ix,1) = A2(ix,1); writetable(table(A1),'da...

6 years ago | 0

Answered
Hi ,i have problem whit the function quad
Make this modifications

6 years ago | 0

Answered
Draw a symmetrical shape on the x-axis, y-axis, and origin using the transformation matrix
I used patch x = [3 3 2 3 5 6 5 5]; y = [1 3 3 4 4 3 3 1]; cla patch(x,y,'r'); patch(x,-y,'r'); patch(y,x,'r'); patch(-y,...

6 years ago | 0

Answered
Not getting direction field for an ode in a proper way.
Correct answer

6 years ago | 0

| accepted

Answered
How can I plot this figure using MATLAB?
Here is patch use x = 0:0.1:1; y = sqrt(x); cla patch([0 0 0],[0 1 0],[0 0 1],'b') % vertical triangle patch([1 0 x],[...

6 years ago | 0

| accepted

Answered
double summation in matlab
Here is numerical approach clc,clear % alignComments b = 0.142e-9; gammao = 3.0; m = 101; hbar = 1; e ...

6 years ago | 1

Answered
2D images into 3D plot
Create 3D object (surface maybe) and use rotate h = surf(peaks); orig1 = [ 0 0 0 ]; ang1 = 15; dir1 = [ 1 0 0]; rotate(h,di...

6 years ago | 0

Answered
Calculating mean angles of edge detection
Try regionprops with orientation property Example BWd1 = 1.0*BWd; data = regionprops(BWd,'orientation','pixelidxlist'); % g...

6 years ago | 0

| accepted

Answered
How would I integrate different values into 4 tables?
Try this solution

6 years ago | 0

Answered
Solving stiff ode system with vector parameters.
I found the problem

6 years ago | 0

Answered
Pre-define a group (plot) properties or passing a group properties in a function
You can use handlers h(1) = plot(..) h(2) = plot(..) set(h,'color','r','linewidth',2)

6 years ago | 0

Answered
Geoshow and pcolor not plotting correctly
See this example clc,clear clf peaksData = ncread('example.nc','peaks'); [m,n] = size(peaksData); [lat,lon] = ndgrid(1:m,1...

6 years ago | 0

Answered
ODE45 in Maxwell-Stefan equation
Here is the solution: f = @(t,y) 1/c/D*(y*(NH2+NH2O)-NH20); [t,y] = ode45(f,[0 2.5e-4],1);

6 years ago | 0

Load more