Answered

Import STL file and convert to Matrix

Try stlread to import geometry Use griddata to interpolate data

Import STL file and convert to Matrix

Try stlread to import geometry Use griddata to interpolate data

3 years ago | 0

Answered

Heatmap - how to get the plotted colors

Just scale values %Exp. Data=[0.216745778875956 0.0122005059399983 0.0162673412533310 0.00149830774701733 0.26338905594...

Heatmap - how to get the plotted colors

Just scale values %Exp. Data=[0.216745778875956 0.0122005059399983 0.0162673412533310 0.00149830774701733 0.26338905594...

3 years ago | 0

Answered

1 D Unsteady Diffusion Equation by Finite Volume (Fully Implicit) Scheme

Try this simple difference scheme: lam = 0.5; % k*dt/rho/dx^2 n = 20; T = zeros(n); T(1,:) = 200; ...

1 D Unsteady Diffusion Equation by Finite Volume (Fully Implicit) Scheme

Try this simple difference scheme: lam = 0.5; % k*dt/rho/dx^2 n = 20; T = zeros(n); T(1,:) = 200; ...

3 years ago | 1

Answered

hello can you please help I'm getting this errorIndex in position 2 exceeds array bounds (must not exceed 1). Error in BetaNewmark_MDOF (line 21) xd(:,i+1)=xd(:,i)+(1-b)*dt*x

You are trying to access allements that don't exist. Try this % xdd(:,i), xdd(:,i+1) % WRONG xdd(i), xdd(i+1) ...

hello can you please help I'm getting this errorIndex in position 2 exceeds array bounds (must not exceed 1). Error in BetaNewmark_MDOF (line 21) xd(:,i+1)=xd(:,i)+(1-b)*dt*x

You are trying to access allements that don't exist. Try this % xdd(:,i), xdd(:,i+1) % WRONG xdd(i), xdd(i+1) ...

3 years ago | 0

Answered

Why do I get "Undefined function or variable" error?

I think your main code should be inside function body

Why do I get "Undefined function or variable" error?

I think your main code should be inside function body

3 years ago | 0

| accepted

Answered

Using Heun's Method but Problem With Increment

I think you should use index (i) everywhere. vh variable has two elements after first iteration You trying to assign two elemen...

Using Heun's Method but Problem With Increment

I think you should use index (i) everywhere. vh variable has two elements after first iteration You trying to assign two elemen...

3 years ago | 1

| accepted

Answered

Sorting Excel values into new vector

Try this ind = find(abs(data-255)<0.1); % find all '255' numbers ind(end+1) = numel(data)+1; % add last i...

Sorting Excel values into new vector

Try this ind = find(abs(data-255)<0.1); % find all '255' numbers ind(end+1) = numel(data)+1; % add last i...

3 years ago | 0

Answered

How to import geometry from STL without approximation ?

Here is an example. Read more: 2-D Geometry Creation at Command Line t = 0:0.2:2*pi; % make sure the curve ...

How to import geometry from STL without approximation ?

Here is an example. Read more: 2-D Geometry Creation at Command Line t = 0:0.2:2*pi; % make sure the curve ...

3 years ago | 0

| accepted

Answered

I need to arrange the elements as shown in the figure. Can anyone suggest an algorithm for this arrangement of elements?

Use flipud A = reshape(1:12,[3 4]); A' flipud(A')

I need to arrange the elements as shown in the figure. Can anyone suggest an algorithm for this arrangement of elements?

Use flipud A = reshape(1:12,[3 4]); A' flipud(A')

3 years ago | 0

| accepted

Answered

Help to model a phisical problem in Matlab

Why about spline? I placed two points close to each other to manipulate with tangent angle x0 = [0 0 2 3 4 4]; ...

Help to model a phisical problem in Matlab

Why about spline? I placed two points close to each other to manipulate with tangent angle x0 = [0 0 2 3 4 4]; ...

3 years ago | 0

Answered

convert double NaN to string NaN

Try num2str a = {nan 1 nan}; cellfun(@num2str,a,'UniformOutput',0)

convert double NaN to string NaN

Try num2str a = {nan 1 nan}; cellfun(@num2str,a,'UniformOutput',0)

3 years ago | 0

Answered

force input in ode

You need to pass F into your ode function. Read more: LINK for i = 1:length(F) [t,y] = ode45(@(t,y)beam_function(t,y,F(i))...

force input in ode

You need to pass F into your ode function. Read more: LINK for i = 1:length(F) [t,y] = ode45(@(t,y)beam_function(t,y,F(i))...

3 years ago | 0

| accepted

Answered

How could I solve this error?

You are using the same variable as in for loop. That why you have an error

How could I solve this error?

You are using the same variable as in for loop. That why you have an error

3 years ago | 0

| accepted

Answered

Finding coordinates in a plot

Use polyxpoly x1 = 0:.1:pi; % first curve y1 = sin(x1); x2 = [0 pi]; % straight line for findinf intersection y...

Finding coordinates in a plot

Use polyxpoly x1 = 0:.1:pi; % first curve y1 = sin(x1); x2 = [0 pi]; % straight line for findinf intersection y...

3 years ago | 1

Answered

how to remove horizontal and vertical lines from image?

Here is an attempt. Use bwlabel then to separate each region and analyze I0 = imread('image.jpeg'); I1 = im2bw(I0,0.2); I2 = ...

how to remove horizontal and vertical lines from image?

Here is an attempt. Use bwlabel then to separate each region and analyze I0 = imread('image.jpeg'); I1 = im2bw(I0,0.2); I2 = ...

3 years ago | 0

Answered

Vectorising piecewise quadratic interpolation function

Here is the vectorized version (not tested) xkj0 = x-x'; xkj0 = xkj0.*eye(size(xkj0)) + eye(size(xkj0)); % make diagonal eleme...

Vectorising piecewise quadratic interpolation function

Here is the vectorized version (not tested) xkj0 = x-x'; xkj0 = xkj0.*eye(size(xkj0)) + eye(size(xkj0)); % make diagonal eleme...

3 years ago | 0

Answered

How to center-align uitable cells which are all numerical values?

Here is an example. Read more about sprintf crit1 = {'Some','Key','Words','Here','To','Set','The','Criterion'}; s = sprintf('%...

How to center-align uitable cells which are all numerical values?

Here is an example. Read more about sprintf crit1 = {'Some','Key','Words','Here','To','Set','The','Criterion'}; s = sprintf('%...

3 years ago | 0

| accepted

Answered

How to view the entire 3D object in XY plane and access the values from it

Try rotate [x,y,z] = ellipsoid(); h = surf(x,y,z); rotate(h,angle,dir,origin) z1 = get(h,'zdata');

How to view the entire 3D object in XY plane and access the values from it

Try rotate [x,y,z] = ellipsoid(); h = surf(x,y,z); rotate(h,angle,dir,origin) z1 = get(h,'zdata');

3 years ago | 0

Answered

How to plot on two y- axis

You have 3D data. How do you want it to plot in 2d? s = load('test.mat')

How to plot on two y- axis

You have 3D data. How do you want it to plot in 2d? s = load('test.mat')

3 years ago | 0

Answered

Replacing certain values in table with NaN based on different conditions

Maybe you need to convert your data into matrix first A = randi(10,5,4) ind = A(:,1) < 5; % have this error when using '...

Replacing certain values in table with NaN based on different conditions

Maybe you need to convert your data into matrix first A = randi(10,5,4) ind = A(:,1) < 5; % have this error when using '...

3 years ago | 0

Answered

how to plot 1x1 struct timeseries having field names cell 1x1 array? The .mat file is a time series data with 3 columns of data with respect to time.

Extrac the data and plo % % Plotting data from the .mat file data = load('THPWM.mat'); fieldnames(data) data.ans x = dat...

how to plot 1x1 struct timeseries having field names cell 1x1 array? The .mat file is a time series data with 3 columns of data with respect to time.

Extrac the data and plo % % Plotting data from the .mat file data = load('THPWM.mat'); fieldnames(data) data.ans x = dat...

3 years ago | 0

| accepted

Answered

how can I compare two columns from a differente table that are similar but no equal and then take the difference?

Here is my idea if length(T2.min) > length(T1.xmin) T = T1; else T = T2; end for i=1:length(T.xmin) if abs(...

how can I compare two columns from a differente table that are similar but no equal and then take the difference?

Here is my idea if length(T2.min) > length(T1.xmin) T = T1; else T = T2; end for i=1:length(T.xmin) if abs(...

3 years ago | 1

Answered

2D contour plot considering the boundary of data

Use initmesh to mesh [x,y,z] = peaks(20); t = linspace(0,-pi,20); [xr,yr] = pol2cart(t,2); % round part x1 = [-3 -3 ...

2D contour plot considering the boundary of data

Use initmesh to mesh [x,y,z] = peaks(20); t = linspace(0,-pi,20); [xr,yr] = pol2cart(t,2); % round part x1 = [-3 -3 ...

3 years ago | 1

Answered

Create an image (pixels) circle with slices (not from the center) and paint each slice a different color

Here is an example with using matrix r0 = 100; % radius of a circle t = linspace(0, 2*pi, 15...

Create an image (pixels) circle with slices (not from the center) and paint each slice a different color

Here is an example with using matrix r0 = 100; % radius of a circle t = linspace(0, 2*pi, 15...

3 years ago | 0

Answered

Interpolate scattered values on a regular grid with bi-harmonic interpolation method

Create appropriate mesh x = linspace(min(reservoir(:,1)),max(reservoir(:,1)),20); y = linspace(min(reservoir(:,2)),max(reservo...

Interpolate scattered values on a regular grid with bi-harmonic interpolation method

Create appropriate mesh x = linspace(min(reservoir(:,1)),max(reservoir(:,1)),20); y = linspace(min(reservoir(:,2)),max(reservo...

3 years ago | 1

Answered

Loop in loop only returns results of first iteration

Try to preallocate Vol variable before for loop. Vol has size 141 after first iteration, that's why you have 282 elements Vol =...

Loop in loop only returns results of first iteration

Try to preallocate Vol variable before for loop. Vol has size 141 after first iteration, that's why you have 282 elements Vol =...

3 years ago | 0

| accepted

Answered

How to place/ define points on a triangulated meshed surface?

Here is another approach, but works only if you don't have points inside: pick a point inside a contour (center) convert data ...

How to place/ define points on a triangulated meshed surface?

Here is another approach, but works only if you don't have points inside: pick a point inside a contour (center) convert data ...

3 years ago | 1

| accepted

Answered

How can I make multiple lines on a graph more spaced apart?

Try semilogy Try legend t = 0:0.1:10; plot(t,sin(t),'.r') line(t,sin(t)) line(t,cos(t),'marker','.','color','g') line(t,co...

How can I make multiple lines on a graph more spaced apart?

Try semilogy Try legend t = 0:0.1:10; plot(t,sin(t),'.r') line(t,sin(t)) line(t,cos(t),'marker','.','color','g') line(t,co...

3 years ago | 0

Answered

How to update main grid with a seperately created subgrid values

Here is an example ind1 = X < min(x(:)) & X < max(x(:)); % indices inbetween smallest and largest 'x' ind2 = Y < min(y(:)) &...

How to update main grid with a seperately created subgrid values

Here is an example ind1 = X < min(x(:)) & X < max(x(:)); % indices inbetween smallest and largest 'x' ind2 = Y < min(y(:)) &...

3 years ago | 0

| accepted

Answered

Hi all I am trying to plot a second order BVP in MATLAB

Here is the problem

Hi all I am trying to plot a second order BVP in MATLAB

Here is the problem

3 years ago | 0