Answered

Selecting a point on a scatter plot, saving index of point

You can use pdist2() and min() functions to select closest to your data points clc,clear x = linspace(0,10,20)'; y = sin(x)...

Selecting a point on a scatter plot, saving index of point

You can use pdist2() and min() functions to select closest to your data points clc,clear x = linspace(0,10,20)'; y = sin(x)...

15 hours ago | 1

| accepted

Answered

Find mean of rows containing decimal numbers in between integers in a column

Use ismembertol() or ismember() (round values to some tolerance if needed) to find indices of integer values Use loop to find m...

Find mean of rows containing decimal numbers in between integers in a column

Use ismembertol() or ismember() (round values to some tolerance if needed) to find indices of integer values Use loop to find m...

21 hours ago | 0

Answered

Unable to link x-axis in subplot

Example clc,clear x = linspace(0,10); y1 = sin(x)./x; y2 = sin(x)/2; ax(1) = subplot(2,1,1); plot(x,y1) ax(2) = subplot...

Unable to link x-axis in subplot

Example clc,clear x = linspace(0,10); y1 = sin(x)./x; y2 = sin(x)/2; ax(1) = subplot(2,1,1); plot(x,y1) ax(2) = subplot...

1 day ago | 0

Answered

Generating binary numbers from signal

Just changed an example from link you gave clc,clear fnx = @(x,fn) sin(2*pi*fn*x).*exp(-fn*abs(x)); t = linspace(0,1.2,57...

Generating binary numbers from signal

Just changed an example from link you gave clc,clear fnx = @(x,fn) sin(2*pi*fn*x).*exp(-fn*abs(x)); t = linspace(0,1.2,57...

2 days ago | 0

| accepted

Answered

how to generate loop for given program

Then use for loop % a(1) = 2; % a(2) = 3; % a(3) = 4; % a(4) = 5; for i = 1:4 a(i) = i+1; end Simple

how to generate loop for given program

Then use for loop % a(1) = 2; % a(2) = 3; % a(3) = 4; % a(4) = 5; for i = 1:4 a(i) = i+1; end Simple

2 days ago | 0

Answered

Issues with the for loop

This should work new_daily_2006 = ids_2006*0; for i = 1:size(ids_2006,1) %* size od ids_2006 is 212*119*177 % i,j,tt ...

Issues with the for loop

This should work new_daily_2006 = ids_2006*0; for i = 1:size(ids_2006,1) %* size od ids_2006 is 212*119*177 % i,j,tt ...

3 days ago | 0

Answered

How can I make my code run faster?

Shorter version of Laplacian_2D function. Is there any connection to gradient and laplacian built-n functions? un = circshift(u...

How can I make my code run faster?

Shorter version of Laplacian_2D function. Is there any connection to gradient and laplacian built-n functions? un = circshift(u...

3 days ago | 0

Answered

How do you define boundary conditions for ode45 or bvp4c?

In function res: % ya(1) - y at a % ya(2) - dy/dt at a % yb(1) - y at b % yb(2) - dy/dt at b a and b you define in main s...

How do you define boundary conditions for ode45 or bvp4c?

In function res: % ya(1) - y at a % ya(2) - dy/dt at a % yb(1) - y at b % yb(2) - dy/dt at b a and b you define in main s...

4 days ago | 0

Answered

How to adjust my video to only save 30 fps while in my for loop that goes upto 20000 iterations?

If you want 20 sec video with 30 fps you just need to write 600 frames For dt=0.001 it is 10000 frames for 10 sec simulation so...

How to adjust my video to only save 30 fps while in my for loop that goes upto 20000 iterations?

If you want 20 sec video with 30 fps you just need to write 600 frames For dt=0.001 it is 10000 frames for 10 sec simulation so...

4 days ago | 0

| accepted

Answered

MATLAB Answers Wish-list #5 (and bug reports)

I want a button for spoiler Can't believe there is no such option on this forum

MATLAB Answers Wish-list #5 (and bug reports)

I want a button for spoiler Can't believe there is no such option on this forum

4 days ago | 0

Answered

Reflection of a fixed point on a 3D plain.

You have straight line ( vector), intersection point P, normal vector of a plane and you want to find vector Find cross produ...

Reflection of a fixed point on a 3D plain.

You have straight line ( vector), intersection point P, normal vector of a plane and you want to find vector Find cross produ...

8 days ago | 0

| accepted

Answered

Calculating arc length of piece wise cubic polynomial

I think the problem is in your arclength() function for t = ent:0.1:ext xd = 3*a*(t-ent)^2 + 2*b*(t-ent)+ c; ...

Calculating arc length of piece wise cubic polynomial

I think the problem is in your arclength() function for t = ent:0.1:ext xd = 3*a*(t-ent)^2 + 2*b*(t-ent)+ c; ...

9 days ago | 1

| accepted

Answered

How to add Hann 5 cycles to the sine wave plot?

One full cycle of sine is 2pi You should make your argument of sine: 0 .. 2pi*5

How to add Hann 5 cycles to the sine wave plot?

One full cycle of sine is 2pi You should make your argument of sine: 0 .. 2pi*5

9 days ago | 1

| accepted

Answered

How can we extract objects from a greyscale image?

What about bwareaopen() I = imread('example_filled2.jpg'); I1 = I < 40; I2 = bwareaopen(I1,3e3); imshow(I2) What i've got ...

How can we extract objects from a greyscale image?

What about bwareaopen() I = imread('example_filled2.jpg'); I1 = I < 40; I2 = bwareaopen(I1,3e3); imshow(I2) What i've got ...

10 days ago | 0

Answered

i want to find distances between coordinate points as i explained below?? any help??

With use of pdist2() A = [0 0]; B = [1 0]; C = [2 0]; [x,y] = meshgrid(0:2,1:2); % D G E H F I D_I = [x(:) y(:)]...

i want to find distances between coordinate points as i explained below?? any help??

With use of pdist2() A = [0 0]; B = [1 0]; C = [2 0]; [x,y] = meshgrid(0:2,1:2); % D G E H F I D_I = [x(:) y(:)]...

10 days ago | 0

| accepted

Answered

Saving animation of projectile motion

Am i correct? video = VideoWriter('trajectories.avi', 'MPEG-4'); open(video) for i1 = 1:n1 % draw something F = ...

Saving animation of projectile motion

Am i correct? video = VideoWriter('trajectories.avi', 'MPEG-4'); open(video) for i1 = 1:n1 % draw something F = ...

11 days ago | 0

Answered

how to do density scatter plot?

C = x*0; for i = 1:length(x) v = (abs(x-x(i)) < R) & (abs(y-y(i)) < R) & (abs(z-z(i)) < R); % how many points in cube...

how to do density scatter plot?

C = x*0; for i = 1:length(x) v = (abs(x-x(i)) < R) & (abs(y-y(i)) < R) & (abs(z-z(i)) < R); % how many points in cube...

13 days ago | 0

| accepted

Answered

Looking for help to Interpolate a column of data in a timeseries data set

I uploaded your data and tried to visualize it % first column - time Z = data{:,2:end}; Z1 = Z(1:600:end,1:3:end); ...

Looking for help to Interpolate a column of data in a timeseries data set

I uploaded your data and tried to visualize it % first column - time Z = data{:,2:end}; Z1 = Z(1:600:end,1:3:end); ...

14 days ago | 0

| accepted

Answered

3D plot of function with if statements

THe dot is forgotten Try to write more readable code: [X,Y] = meshgrid(0:0.5:10); %Evaluates the function between 0 and 10 i...

3D plot of function with if statements

THe dot is forgotten Try to write more readable code: [X,Y] = meshgrid(0:0.5:10); %Evaluates the function between 0 and 10 i...

14 days ago | 0

| accepted

Answered

Draw contourslice on patch surface

Try to refine mesh of your plane I attached a simple example (help example modified) Can you attach your data

Draw contourslice on patch surface

Try to refine mesh of your plane I attached a simple example (help example modified) Can you attach your data

15 days ago | 1

| accepted

Answered

How to test if points are inside a point cloud model

Hi. I wrote a script and somehow it works 0_0. See attached script This is what i ahieved Maybe someone can please explain...

How to test if points are inside a point cloud model

Hi. I wrote a script and somehow it works 0_0. See attached script This is what i ahieved Maybe someone can please explain...

17 days ago | 0

| accepted

Answered

How to fill and calculate the area between two FFT curves?

You have to find where those curve intersect Use polyxpoly() for example

How to fill and calculate the area between two FFT curves?

You have to find where those curve intersect Use polyxpoly() for example

18 days ago | 0

Answered

How to plot diagonal lines starting at the last line's end point?

Here is what i achieved Am i succeeded?

How to plot diagonal lines starting at the last line's end point?

Here is what i achieved Am i succeeded?

19 days ago | 0

| accepted

Answered

Use of command reshape

nSpecies = 5; n_ax = 25; n_rad = 10; C0 = [0;0;0;0;In]; Y0 = repmat(C0,n_ax,n_rad); % size of ...

Use of command reshape

nSpecies = 5; n_ax = 25; n_rad = 10; C0 = [0;0;0;0;In]; Y0 = repmat(C0,n_ax,n_rad); % size of ...

19 days ago | 0

Answered

How to obtain a surface plot of f(x, y, z) = c

Rewrite expression (x - 31/20)^2 + (x - 981/250)^2 + ... % mininum possible value is 2.81 (x=2.74) (y - 461/100...

How to obtain a surface plot of f(x, y, z) = c

Rewrite expression (x - 31/20)^2 + (x - 981/250)^2 + ... % mininum possible value is 2.81 (x=2.74) (y - 461/100...

19 days ago | 0

Answered

How can I set 'EdgeLighting' for a patch line across a surface, so it matches the surface lighting?

Can you generate surface like this instead of 3D curve? Then you could just use surfnorm() again and extract normal vector you w...

How can I set 'EdgeLighting' for a patch line across a surface, so it matches the surface lighting?

Can you generate surface like this instead of 3D curve? Then you could just use surfnorm() again and extract normal vector you w...

20 days ago | 1

Answered

How to get a slice plot from a 3d surface plot for a particular Z value?

I will be happy if you try contour()

How to get a slice plot from a 3d surface plot for a particular Z value?

I will be happy if you try contour()

20 days ago | 0

| accepted