Answered

Second derivative from a smoothing spline fit

Here you go n = 50; x = linspace(0,10,n); y = sin(x).*x; d2y = diff(y,2)./(x(2)-x(1))/2; % second derivative ix = ...

Second derivative from a smoothing spline fit

Here you go n = 50; x = linspace(0,10,n); y = sin(x).*x; d2y = diff(y,2)./(x(2)-x(1))/2; % second derivative ix = ...

circa 17 ore ago | 0

| accepted

Answered

How to draw a 2D histogram from a time series?

My proposition A = importdata('temp_data.csv',','); temp = A.data; time = A.textdata; time(:,2) = []; time(1) = []; ...

How to draw a 2D histogram from a time series?

My proposition A = importdata('temp_data.csv',','); temp = A.data; time = A.textdata; time(:,2) = []; time(1) = []; ...

1 giorno ago | 0

Answered

Seperating labeled array areas using contourf

You want x,y coordinates of boundaries? Or what kind of format it should be? clc,clear load areas.mat I = (image_array); lev...

Seperating labeled array areas using contourf

You want x,y coordinates of boundaries? Or what kind of format it should be? clc,clear load areas.mat I = (image_array); lev...

2 giorni ago | 0

Answered

repeat the iteration with an error using try/catch

My proposition for iTcm=1:nTcm for iScen=1:nScen iEv = 0; while iEv <= nEv iEv = iEv + 1...

repeat the iteration with an error using try/catch

My proposition for iTcm=1:nTcm for iScen=1:nScen iEv = 0; while iEv <= nEv iEv = iEv + 1...

2 giorni ago | 0

Answered

cropping a serie of images and save only the cropped part of it

Tri this (not tested) dirName = uigetdir('./', 'Select data folder'); cd(dirName); fname = sprintf('SI380820191011130728_%03...

cropping a serie of images and save only the cropped part of it

Tri this (not tested) dirName = uigetdir('./', 'Select data folder'); cd(dirName); fname = sprintf('SI380820191011130728_%03...

3 giorni ago | 0

| accepted

Answered

2D plot to 3D Graph

I made a simple example for you x = 0:10; y = sin(x)+2; t = linspace(0,2*pi,30); [T,Y] = meshgrid(t,y); [~,X] = meshgrid(t,...

2D plot to 3D Graph

I made a simple example for you x = 0:10; y = sin(x)+2; t = linspace(0,2*pi,30); [T,Y] = meshgrid(t,y); [~,X] = meshgrid(t,...

3 giorni ago | 0

| accepted

Answered

ode does not converge

I tried tt = [0 1]; options=odeset('RelTol',1e-3,'AbsTol',1e-3);

ode does not converge

I tried tt = [0 1]; options=odeset('RelTol',1e-3,'AbsTol',1e-3);

3 giorni ago | 0

Answered

I need to get counterlines outside the U.S. removed (Ocean/Canada/Mexico)! Se script below.

Use handler options % Call contourm [~,h] = contourm(LatGrid, LonGrid, OzoneGrid); h1 = get(h,'children'); % for ...

I need to get counterlines outside the U.S. removed (Ocean/Canada/Mexico)! Se script below.

Use handler options % Call contourm [~,h] = contourm(LatGrid, LonGrid, OzoneGrid); h1 = get(h,'children'); % for ...

3 giorni ago | 0

Answered

Legend of a patch-object with a line in the center

What about this? Too complicated? No? clc,clear cla [X,Y,Z] = peaks(5); p = surf2patch(X,Y,Z); p1 = patch(p,'facecolor','g'...

Legend of a patch-object with a line in the center

What about this? Too complicated? No? clc,clear cla [X,Y,Z] = peaks(5); p = surf2patch(X,Y,Z); p1 = patch(p,'facecolor','g'...

3 giorni ago | 0

| accepted

Answered

how to plot an image and a logical matrix on same plot

Try this ind = mask > 0.8; img(ind) = max(img(:)); imshow(img)

how to plot an image and a logical matrix on same plot

Try this ind = mask > 0.8; img(ind) = max(img(:)); imshow(img)

3 giorni ago | 0

Answered

How to create an animation by choosing rows in a matrix to switch with time. Truss simulation

Here is my achievement: i just scaled colors while moving

How to create an animation by choosing rows in a matrix to switch with time. Truss simulation

Here is my achievement: i just scaled colors while moving

3 giorni ago | 0

Answered

Finding odd and even values without functions

What about dividing? while 1 a = a/2; if abs(a-1) < 0.01 % if very close to '1' disp('even') ...

Finding odd and even values without functions

What about dividing? while 1 a = a/2; if abs(a-1) < 0.01 % if very close to '1' disp('even') ...

3 giorni ago | 0

| accepted

Answered

Adjusting the transparency of a contour plot using a gradient of alpha values

Here is my today achievement clc,clear opengl software n = 1000; [X,Y,Z] = peaks(20); % surf(X,Y,Z,'facecolor','none') hol...

Adjusting the transparency of a contour plot using a gradient of alpha values

Here is my today achievement clc,clear opengl software n = 1000; [X,Y,Z] = peaks(20); % surf(X,Y,Z,'facecolor','none') hol...

4 giorni ago | 0

Answered

Subplot titles on each column.

What about brute force? clc,clear clf subplot 121 plot(0,0) subplot 122 plot(1,1) h1 = annotation('textbox',[0.25 0.95 0....

Subplot titles on each column.

What about brute force? clc,clear clf subplot 121 plot(0,0) subplot 122 plot(1,1) h1 = annotation('textbox',[0.25 0.95 0....

4 giorni ago | 0

Answered

I want the points that located in a certain polygon

You use different order of lan/lot. Change places in red squares

I want the points that located in a certain polygon

You use different order of lan/lot. Change places in red squares

4 giorni ago | 1

| accepted

Answered

How do I remove all fields of a structure that have at least one NaN?

Try rmfield a = [1 nan 3]; bb = [1 2 3]; S.a = a; S.bb = bb; S nms = fieldnames(S); for i = 1:length(nms) f = getfie...

How do I remove all fields of a structure that have at least one NaN?

Try rmfield a = [1 nan 3]; bb = [1 2 3]; S.a = a; S.bb = bb; S nms = fieldnames(S); for i = 1:length(nms) f = getfie...

4 giorni ago | 1

Answered

For loop on a 3D matrix to get a range of slices

Use find and sum find(sum(sum(SG,1),2)) % number of nonzero slices

For loop on a 3D matrix to get a range of slices

Use find and sum find(sum(sum(SG,1),2)) % number of nonzero slices

5 giorni ago | 0

| accepted

Answered

Gantt Chart on Matlab

Use only 3d column A = [ 1 0 11 2 11 24 3 24 40 4 40 60 5 60 80]; bar(A(:,3))

Gantt Chart on Matlab

Use only 3d column A = [ 1 0 11 2 11 24 3 24 40 4 40 60 5 60 80]; bar(A(:,3))

5 giorni ago | 0

Answered

Symbolic Calculation to Numeric value for limit of an integral

Look at your signal t = linspace(0,100); signal = @(t) -3*(sin((t-5/2)/3)); area(t,signal(t)) axis equal It never ends! Int...

Symbolic Calculation to Numeric value for limit of an integral

Look at your signal t = linspace(0,100); signal = @(t) -3*(sin((t-5/2)/3)); area(t,signal(t)) axis equal It never ends! Int...

5 giorni ago | 0

| accepted

Answered

Creating a matrix from spaced out lines of another matrix

Try this dx = max(x)-min(x); ix = round((x-min(x))/max(x)*2) + 1; % result 1 2 3 ind = cell(3,1); for i = 1:length(ind) ...

Creating a matrix from spaced out lines of another matrix

Try this dx = max(x)-min(x); ix = round((x-min(x))/max(x)*2) + 1; % result 1 2 3 ind = cell(3,1); for i = 1:length(ind) ...

5 giorni ago | 0

Answered

How can I put an integral inside a for loop when the bounds depend on the loop's variable?

Here is an example for integral3 According to this integration is done from z to x You have only y. Looks like x=x(y) in yo...

How can I put an integral inside a for loop when the bounds depend on the loop's variable?

Here is an example for integral3 According to this integration is done from z to x You have only y. Looks like x=x(y) in yo...

5 giorni ago | 1

| accepted

Answered

How to remove or exclude the intersecting part from two intersecting or overlaping spheres using Matlab?

Here is what i invented ix1 = (xc1-x2).^2+(yc1-y2).^2+(zc1-z2).^2 < R2^2; ix2 = (xc2-x1).^2+(yc2-y1).^2+(zc2-z1).^2 < R1^2; s...

How to remove or exclude the intersecting part from two intersecting or overlaping spheres using Matlab?

Here is what i invented ix1 = (xc1-x2).^2+(yc1-y2).^2+(zc1-z2).^2 < R2^2; ix2 = (xc2-x1).^2+(yc2-y1).^2+(zc2-z1).^2 < R1^2; s...

5 giorni ago | 2

| accepted

Answered

Using IF condition with ODE

Maybe you don't need event function for this case. I just add persistent variable to your ode function function main clear fun...

Using IF condition with ODE

Maybe you don't need event function for this case. I just add persistent variable to your ode function function main clear fun...

5 giorni ago | 0

Answered

how plot a correct interpolation with surf plot?

It happens because of different scales of data. Don't know why MATLAB get confused about it (even linear interpolation) scale...

how plot a correct interpolation with surf plot?

It happens because of different scales of data. Don't know why MATLAB get confused about it (even linear interpolation) scale...

6 giorni ago | 0

| accepted

Answered

"dsolve" gives some extra terms in the solution

Here is comparison of solutions. See script inside

"dsolve" gives some extra terms in the solution

Here is comparison of solutions. See script inside

6 giorni ago | 0

Answered

Interpolating scattered data within a shapefile/worldmap

Here is my effort. Am i succeeded? S = importdata('CP_c.csv'); A = S.data; x = A(:,1); y = A(:,2); z = A(:,3); xx = linspa...

Interpolating scattered data within a shapefile/worldmap

Here is my effort. Am i succeeded? S = importdata('CP_c.csv'); A = S.data; x = A(:,1); y = A(:,2); z = A(:,3); xx = linspa...

7 giorni ago | 0

Answered

How can I plot two variables with the line color varying as the third variable?

Use patch x = linspace(0,10); y = sin(x); c = jet(100); n = length(x); fv = [1:n-1;2:n]'; patch('faces',fv,'vertices',[x; ...

How can I plot two variables with the line color varying as the third variable?

Use patch x = linspace(0,10); y = sin(x); c = jet(100); n = length(x); fv = [1:n-1;2:n]'; patch('faces',fv,'vertices',[x; ...

7 giorni ago | 0

Answered

Voronoi Diagram in Dashed Lines

Try to grab only handles of voronoi lines set(h(2:end),'linestyle','--')

Voronoi Diagram in Dashed Lines

Try to grab only handles of voronoi lines set(h(2:end),'linestyle','--')

7 giorni ago | 0

| accepted

Answered

How to use normal, length, width, and center coordinates to create a rectangular surface in three dimensions？

Create Left vector using cross product p0 = [X Y Z]; % origin p1 = p0 + height/2*Up + width/2*left; p2 = ... % do al...

How to use normal, length, width, and center coordinates to create a rectangular surface in three dimensions？

Create Left vector using cross product p0 = [X Y Z]; % origin p1 = p0 + height/2*Up + width/2*left; p2 = ... % do al...

7 giorni ago | 0

| accepted