Answered

Extract data along line from gridded data

Read about interp2.

Extract data along line from gridded data

Read about interp2.

ongeveer 2 maanden ago | 0

| accepted

Answered

Implementing Euler's method for a 1D system

h=0.1; x=-5:h:5; y=zeros(size(x)); y(1)=0; for n=1:length(x)-1 dydx=3*x(n).^2+2*x(n)-12; y(n+1)=y(n)+dydx*h; end ...

Implementing Euler's method for a 1D system

h=0.1; x=-5:h:5; y=zeros(size(x)); y(1)=0; for n=1:length(x)-1 dydx=3*x(n).^2+2*x(n)-12; y(n+1)=y(n)+dydx*h; end ...

ongeveer 2 maanden ago | 0

| accepted

Answered

Plot of a butterfly using mathematical equations

Don't use loop...instead use scatter. Read about it. clc; clear all ; clear; close all; clc; sin1 =@(k) sin((pi*k)./40000...

Plot of a butterfly using mathematical equations

Don't use loop...instead use scatter. Read about it. clc; clear all ; clear; close all; clc; sin1 =@(k) sin((pi*k)./40000...

2 maanden ago | 1

| accepted

Answered

Scatter points with a colormap based on distances

You can use scatter3. x = rand(10,1) ; y = rand(10,1) ; z = rand(10,1) ; d = rand(10,1) ; scatter3(x,y,z,[],d,'filled') ...

Scatter points with a colormap based on distances

You can use scatter3. x = rand(10,1) ; y = rand(10,1) ; z = rand(10,1) ; d = rand(10,1) ; scatter3(x,y,z,[],d,'filled') ...

2 maanden ago | 1

| accepted

Answered

how to calculate and plot rmse matrix

Let O be your observation data array of size mX1 and M be your model data array of size mx40. O = rand(30,1) ; M = rand(30,40...

how to calculate and plot rmse matrix

Let O be your observation data array of size mX1 and M be your model data array of size mx40. O = rand(30,1) ; M = rand(30,40...

2 maanden ago | 0

| accepted

Answered

How to use gpu for deep learning

Check the trainingOptions, in there you have option to specify the execution environment. Example: options = trainingOpti...

How to use gpu for deep learning

Check the trainingOptions, in there you have option to specify the execution environment. Example: options = trainingOpti...

2 maanden ago | 0

Answered

Finding the highest mountain peak

[val,idx] = max(Z,[],3) ; Get the maximum along third dimension, idx gives you the thirs index where max occurs. Now find the ...

Finding the highest mountain peak

[val,idx] = max(Z,[],3) ; Get the maximum along third dimension, idx gives you the thirs index where max occurs. Now find the ...

2 maanden ago | 0

| accepted

Answered

Find the polar representation of (𝑖 − √3 )

Hint: Use abs to find r. Use atan to find the angle. Use sin, cos to get the polar form. x = r*cos(theta) ; y = r*sin(th...

Find the polar representation of (𝑖 − √3 )

Hint: Use abs to find r. Use atan to find the angle. Use sin, cos to get the polar form. x = r*cos(theta) ; y = r*sin(th...

2 maanden ago | 0

Answered

How do I find a maximum within a certain range

Let (x,y) be your data arrays. idx = x>0.1 & x<0.7 ; iwant = max(x(idx)) ;

How do I find a maximum within a certain range

Let (x,y) be your data arrays. idx = x>0.1 & x<0.7 ; iwant = max(x(idx)) ;

2 maanden ago | 0

Answered

Drawing a boundary box around an image?

I = imread('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1139790/bb.png'); props = regionprops(rgb2gray(I), 'B...

Drawing a boundary box around an image?

I = imread('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1139790/bb.png'); props = regionprops(rgb2gray(I), 'B...

2 maanden ago | 0

Answered

Pseudorandom character matrix generation

s = {'b', 'd', 'p', 'q' } ; S = cell(10) ; for i = 1:10 for j = 1:10 t = s(randperm(4,4)) ; S{i,...

Pseudorandom character matrix generation

s = {'b', 'd', 'p', 'q' } ; S = cell(10) ; for i = 1:10 for j = 1:10 t = s(randperm(4,4)) ; S{i,...

2 maanden ago | 0

Answered

How to interpolate a set of data with the cubic method?

x = [74 29 21 12 8 5.7 4.4 3.6 2.1 1.8 1.5 1.0 0.7]; y = [80 131 189 270 320 407 450 530 620 686 740 900 1095]; yi = linspac...

How to interpolate a set of data with the cubic method?

x = [74 29 21 12 8 5.7 4.4 3.6 2.1 1.8 1.5 1.0 0.7]; y = [80 131 189 270 320 407 450 530 620 686 740 900 1095]; yi = linspac...

2 maanden ago | 0

| accepted

Answered

comparing two times to find the nearest minute for a specific time

Read about ismember, ismembertol, knnsearch

comparing two times to find the nearest minute for a specific time

Read about ismember, ismembertol, knnsearch

2 maanden ago | 0

Answered

Error about preallocating for speed

You need to proceed likt his: % Alpha Fe a = []; T = 25:5:1000 ; nT = length(T) ; a = zeros(nT,1) ; for i = 1:length(T...

Error about preallocating for speed

You need to proceed likt his: % Alpha Fe a = []; T = 25:5:1000 ; nT = length(T) ; a = zeros(nT,1) ; for i = 1:length(T...

2 maanden ago | 0

Answered

Unsing string for indexing though structures

i = 108; % A = ((0.1255)/2)^2*pi; % ml_in_m3 = 1e-6; while i <= 108 pfad = '...'; s = strcat(pfad,'Test3_',string(i...

Unsing string for indexing though structures

i = 108; % A = ((0.1255)/2)^2*pi; % ml_in_m3 = 1e-6; while i <= 108 pfad = '...'; s = strcat(pfad,'Test3_',string(i...

2 maanden ago | 0

Answered

create cell array by extracting all the same row from multiple matrix

D = cell(105,5) ; for i = 1:105 D{i} = [A(i,:) B(i,:) C(i,:)] ; end Or D = [A B C] ; D = num2cell(D,2) ;

create cell array by extracting all the same row from multiple matrix

D = cell(105,5) ; for i = 1:105 D{i} = [A(i,:) B(i,:) C(i,:)] ; end Or D = [A B C] ; D = num2cell(D,2) ;

2 maanden ago | 0

Answered

Extract a range of frequencies from a vector/array

new_value_from_fnew = fnew(fnew == 10e+009 | fnew > 30e+009); % <--- replace = with ==

Extract a range of frequencies from a vector/array

new_value_from_fnew = fnew(fnew == 10e+009 | fnew > 30e+009); % <--- replace = with ==

2 maanden ago | 0

| accepted

Answered

Trying to define a circle within a matrix

[X,Y] = meshgrid(1:50) ; C = [mean(X(:)) mean(Y(:))] ; R = 10 ; th = linspace(0,2*pi) ; x = C(1)+R*cos(th) ; y = C(2)+R...

Trying to define a circle within a matrix

[X,Y] = meshgrid(1:50) ; C = [mean(X(:)) mean(Y(:))] ; R = 10 ; th = linspace(0,2*pi) ; x = C(1)+R*cos(th) ; y = C(2)+R...

2 maanden ago | 0

Answered

How to find coordinate if only x is given?

Rm = sqrt(x.^2+y.^2) ; % get radius from mexh (x,y) R = 75 ; tol = 10^-3 ; idx = find(abs(Rm-R)<tol) ; iwant = [idx x(idx)...

How to find coordinate if only x is given?

Rm = sqrt(x.^2+y.^2) ; % get radius from mexh (x,y) R = 75 ; tol = 10^-3 ; idx = find(abs(Rm-R)<tol) ; iwant = [idx x(idx)...

2 maanden ago | 0

Answered

How to read all CSV files within a folder, combine into one master file using columns, and edit column headers?

folderPath1 = 'C:\Users\matav\Documents\MATLAB\example'; cd(folderPath1); % opens path of the folder csvFiles = dir('*.csv') ;...

How to read all CSV files within a folder, combine into one master file using columns, and edit column headers?

folderPath1 = 'C:\Users\matav\Documents\MATLAB\example'; cd(folderPath1); % opens path of the folder csvFiles = dir('*.csv') ;...

2 maanden ago | 0

Answered

How do these Python commands have to look in Matlab to calculate A and B and show me the two results?

A = 10+10; B = A+10 ; fprintf('A = %f, B = %f\n',A,B) ;

How do these Python commands have to look in Matlab to calculate A and B and show me the two results?

A = 10+10; B = A+10 ; fprintf('A = %f, B = %f\n',A,B) ;

2 maanden ago | 0

| accepted

Answered

Read multiple CSV files from different folders uing readtable

thepaths = {p1,p2,p3} ; for i = 1:3 % loop for ech folder csvFiles = dir([thepaths{i},'\*csv']) ; % get ll csv files in ...

Read multiple CSV files from different folders uing readtable

thepaths = {p1,p2,p3} ; for i = 1:3 % loop for ech folder csvFiles = dir([thepaths{i},'\*csv']) ; % get ll csv files in ...

2 maanden ago | 0

Answered

read many ncdata using ncread

ncfiles = dir('*.nc') ; N = length(ncfiles) ; for i = 1:N thisfile = ncfiles(i).name ; % do your calculation end...

read many ncdata using ncread

ncfiles = dir('*.nc') ; N = length(ncfiles) ; for i = 1:N thisfile = ncfiles(i).name ; % do your calculation end...

2 maanden ago | 0

| accepted

Answered

streamline function gives empty output

Try replacing NaN's in u, v with zero and use stream2.

streamline function gives empty output

Try replacing NaN's in u, v with zero and use stream2.

2 maanden ago | 0

Answered

Graph appears blank but the equation and code are correct.

H_k_eq = @(k) (exp(-pi.*k.^2)) ./ (exp(-pi.*k.^2) + exp(-pi.*(4.*k).^2)); %<-- element by element division Range = -0.5:.01:...

Graph appears blank but the equation and code are correct.

H_k_eq = @(k) (exp(-pi.*k.^2)) ./ (exp(-pi.*k.^2) + exp(-pi.*(4.*k).^2)); %<-- element by element division Range = -0.5:.01:...

2 maanden ago | 1

Answered

Solving Unknowns with Symbolic Toolbox

A = [1 1 0 0 ; 0 0 1 1 ; 1 0 1 0 ; 0 1 0 1] ; b = [3;7;4;6] ; x = pinv(A)*b Note that rank of A is 3, so...

Solving Unknowns with Symbolic Toolbox

A = [1 1 0 0 ; 0 0 1 1 ; 1 0 1 0 ; 0 1 0 1] ; b = [3;7;4;6] ; x = pinv(A)*b Note that rank of A is 3, so...

2 maanden ago | 0

| accepted

Answered

Plotting a 3D matrix with plot3

LambdaL = linspace(0.000001,0.0001,20); % [Matrix in X axis] LambdaT = linspace(0.000001,0.0001,20); % [Matrix in Y axis] ...

Plotting a 3D matrix with plot3

LambdaL = linspace(0.000001,0.0001,20); % [Matrix in X axis] LambdaT = linspace(0.000001,0.0001,20); % [Matrix in Y axis] ...

2 maanden ago | 0