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

environ 9 heures 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

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

1 jour 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; ...

1 jour 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','--')

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

1 jour ago | 0

Answered

Fill in missing NaNs

Use bwlabel A1 = isnan(A); % find NaN [L,n] = bwlabel(A1); % label each re...

Fill in missing NaNs

Use bwlabel A1 = isnan(A); % find NaN [L,n] = bwlabel(A1); % label each re...

1 jour ago | 1

Answered

Need matlab coding for the given c program

try this i = 1; a{1} = '1'; while ~strcmp(a(i),'&') str = input('','s'); i = i + 1; a{i} = str; end

Need matlab coding for the given c program

try this i = 1; a{1} = '1'; while ~strcmp(a(i),'&') str = input('','s'); i = i + 1; a{i} = str; end

1 jour ago | 0

Answered

How to pick an answer from solver for further calculations

Use logical operators ix = 0<Xi && Xi<1; x1 = Xi(ix);

How to pick an answer from solver for further calculations

Use logical operators ix = 0<Xi && Xi<1; x1 = Xi(ix);

1 jour ago | 0

Answered

Question for color set in colorbar

Yes, there is a way. Use colormap cmap = hot(100); colormap(cmap(30:end,:)) % i use only last 70 values because first 3...

Question for color set in colorbar

Yes, there is a way. Use colormap cmap = hot(100); colormap(cmap(30:end,:)) % i use only last 70 values because first 3...

1 jour ago | 0

Answered

Deleting overlapping segments between two vectors

Use bwselect cross = a.*b; ix = find(cross); % cross indices ia = bwselect(a,ix,1+ix*0); % find regions in ...

Deleting overlapping segments between two vectors

Use bwselect cross = a.*b; ix = find(cross); % cross indices ia = bwselect(a,ix,1+ix*0); % find regions in ...

1 jour ago | 0

| accepted

Answered

How Can you redesign this code? Same result but different structure

You can remove some constants from for loop to speed up your code This part can be shorter and vectorized % for i=1:p % ...

How Can you redesign this code? Same result but different structure

You can remove some constants from for loop to speed up your code This part can be shorter and vectorized % for i=1:p % ...

2 jours ago | 0

| accepted

Answered

How can I plot an equation to its time lag?

Use for loops c(1) = w + (1-b)*(1+r)*a0 + D; for t = 1:n-1 c(t+1) = (1+r)*(c(t)-ch)*b + ch; end plot(1:n,c)

How can I plot an equation to its time lag?

Use for loops c(1) = w + (1-b)*(1+r)*a0 + D; for t = 1:n-1 c(t+1) = (1+r)*(c(t)-ch)*b + ch; end plot(1:n,c)

2 jours ago | 0

Answered

Fullfile function gives me a false reading with the slash symbol

Try this Or you can remove slash symbol fileToRead(end-5) = [];

Fullfile function gives me a false reading with the slash symbol

Try this Or you can remove slash symbol fileToRead(end-5) = [];

2 jours ago | 0

| accepted

Answered

Memory efficient vectorization of a for loop

Store values manually like sparse % preallocation? irow = []; icol = []; iplane = []; for i = 1:... % do stuff ...

Memory efficient vectorization of a for loop

Store values manually like sparse % preallocation? irow = []; icol = []; iplane = []; for i = 1:... % do stuff ...

2 jours ago | 0

Answered

Change in velocity equation with explicit method

Here is what i think about this question for n = 2:length(t) if m(n-1) > me % if rocket has fuel dm = ...

Change in velocity equation with explicit method

Here is what i think about this question for n = 2:length(t) if m(n-1) > me % if rocket has fuel dm = ...

2 jours ago | 0

Answered

How do i store value in a array from for loop?

I give you simple example for a start n = 10; y = zeros(1,n); for i = 1:n-1 x = x + dx; dy = sin(x); y(i+1) = ...

How do i store value in a array from for loop?

I give you simple example for a start n = 10; y = zeros(1,n); for i = 1:n-1 x = x + dx; dy = sin(x); y(i+1) = ...

3 jours ago | 1

| accepted

Answered

How can I plot a system of nonlinear ODEs with an added term used to model chemotherapy?

Here is an idea: function main t1 = 0.01; % start period t2 = tau-0.01; % end period hold on ...

How can I plot a system of nonlinear ODEs with an added term used to model chemotherapy?

Here is an idea: function main t1 = 0.01; % start period t2 = tau-0.01; % end period hold on ...

4 jours ago | 0

Answered

Create Bar Charts with different number of groups for each iteration.

Try NaN for f=1:nBFonds figure(f) Var = nan(1,26); pInd=transpose(peersInd==f); Var1 = [TotRetB(1,f);TotRet...

Create Bar Charts with different number of groups for each iteration.

Try NaN for f=1:nBFonds figure(f) Var = nan(1,26); pInd=transpose(peersInd==f); Var1 = [TotRetB(1,f);TotRet...

4 jours ago | 1

Answered

Is griddedinterpolant omits NaN?

You can find out by yourself [X,Y] = meshgrid(0:10); Z = 0*X; Z(5:7,5:7) = nan; surf(X,Y,Z,'edgecolor','none') [X1,Y1] = ...

Is griddedinterpolant omits NaN?

You can find out by yourself [X,Y] = meshgrid(0:10); Z = 0*X; Z(5:7,5:7) = nan; surf(X,Y,Z,'edgecolor','none') [X1,Y1] = ...

4 jours ago | 1

| accepted

Answered

Index in position 1 exceeds array bounds (must not exceed 1)

i am sure that indexing is right

Index in position 1 exceeds array bounds (must not exceed 1)

i am sure that indexing is right

4 jours ago | 0

Answered

Produce equality matrix based on elements in vector.

Try bsxfun % make all combinations using bsxfun C = bsxfun(@minus,b(:),a(:)'); % b - rows, a - columns [i,j] = find(~C);...

Produce equality matrix based on elements in vector.

Try bsxfun % make all combinations using bsxfun C = bsxfun(@minus,b(:),a(:)'); % b - rows, a - columns [i,j] = find(~C);...

4 jours ago | 0

Answered

How to sum specific elements in a row of a matrix

try this A = rand(256); srow = 0; for i = 1:16:size(A,1) srow = srow + sum(A(i:i+3,:),1); end

How to sum specific elements in a row of a matrix

try this A = rand(256); srow = 0; for i = 1:16:size(A,1) srow = srow + sum(A(i:i+3,:),1); end

4 jours ago | 1

Answered

How to calculate the arterial wall thickness on an image?

You should have some scale parameters Here is idea: human = 45 * 3/100 = 1.35 [m]

How to calculate the arterial wall thickness on an image?

You should have some scale parameters Here is idea: human = 45 * 3/100 = 1.35 [m]

5 jours ago | 0

Answered

Generate a random orthonormal vector (i) to a given unit vector and (ii) with n-2 predetermined components

What about fsolve b = 1; c = 1; v1 = [-0.52 0.72 -0.19 0.37 -0.18]; v2 = @(x)[x b c 0.45 -0.09]; F = @(x) dot(v1,v2(x)); r...

Generate a random orthonormal vector (i) to a given unit vector and (ii) with n-2 predetermined components

What about fsolve b = 1; c = 1; v1 = [-0.52 0.72 -0.19 0.37 -0.18]; v2 = @(x)[x b c 0.45 -0.09]; F = @(x) dot(v1,v2(x)); r...

5 jours ago | 0

Answered

Pass out a dependent variable from ode15s without taking the derivative of it

You should calculate rr variable after solving ode45 An example function main [t,u] = ode45(@f,[0.1 3],[1 1]); u1 = u(:,1); ...

Pass out a dependent variable from ode15s without taking the derivative of it

You should calculate rr variable after solving ode45 An example function main [t,u] = ode45(@f,[0.1 3],[1 1]); u1 = u(:,1); ...

5 jours ago | 0

| accepted

Answered

PLOT IS NOT SHOWING ANYTHING

Use subplot to draw curvees in separate windows subplot(2,1,1) plot(T,Y(:,1),'r') subplot(2,1,2)] plot(T,Y(:,2),'r')

PLOT IS NOT SHOWING ANYTHING

Use subplot to draw curvees in separate windows subplot(2,1,1) plot(T,Y(:,1),'r') subplot(2,1,2)] plot(T,Y(:,2),'r')

5 jours ago | 0

Answered

fsolve stopped because the problem appears regular

Try this [X,Y] = meshgrid((-6:0)*1e34, (-10:10)*1e34); Z1 = X*0; Z2 = X*0; for i = 1:size(X,1) for j = 1:size(X,2) ...

fsolve stopped because the problem appears regular

Try this [X,Y] = meshgrid((-6:0)*1e34, (-10:10)*1e34); Z1 = X*0; Z2 = X*0; for i = 1:size(X,1) for j = 1:size(X,2) ...

5 jours ago | 0

| accepted

Answered

Move STL object in matlab

Example: the code for selecting pink object fv = stlread(fileName); % extract data v = fv.vertices; ...

Move STL object in matlab

Example: the code for selecting pink object fv = stlread(fileName); % extract data v = fv.vertices; ...

5 jours ago | 0

Answered

How do I modify this bracketing bisection method from a 'for' loop to a 'while loop'??

Solution

How do I modify this bracketing bisection method from a 'for' loop to a 'while loop'??

Solution

6 jours ago | 0