Answered

Plot the graph using non linear equation

It seems that you are solve equations of h for different parameters theta. You can solve the equation one by one. Don't add sp...

Plot the graph using non linear equation

It seems that you are solve equations of h for different parameters theta. You can solve the equation one by one. Don't add sp...

15 days ago | 0

| accepted

Answered

Runga-Kutta Method for system of first order differential equations

Looks like you need to choose a much smaller step size for the problem. %% Initialization tspan = 100; h = 0.125/50; fact = ...

Runga-Kutta Method for system of first order differential equations

Looks like you need to choose a much smaller step size for the problem. %% Initialization tspan = 100; h = 0.125/50; fact = ...

15 days ago | 0

Answered

Extract data above threshold from groups

load('xydata.mat') edges = (min(pp):20:max(pp)); [N, edges, bin] = histcounts(pp, edges); figure gscatter(pp,cc,bin) ...

Extract data above threshold from groups

load('xydata.mat') edges = (min(pp):20:max(pp)); [N, edges, bin] = histcounts(pp, edges); figure gscatter(pp,cc,bin) ...

16 days ago | 0

| accepted

Answered

subplot with for loop after 10 new figure

for i=1:100 % any number if rem(i-1, 10) == 0 figure; end sgtitle('WSPL zeitlicher Verlauf Modell D Te...

subplot with for loop after 10 new figure

for i=1:100 % any number if rem(i-1, 10) == 0 figure; end sgtitle('WSPL zeitlicher Verlauf Modell D Te...

16 days ago | 0

| accepted

Answered

How to check if my array is square with if and else loops?

A = [1 -2 1; 0 2 -8; -4 5 9] if ndims(A)==2 && (size(A,1)==size(A,2)) disp("A is Square") end

How to check if my array is square with if and else loops?

A = [1 -2 1; 0 2 -8; -4 5 9] if ndims(A)==2 && (size(A,1)==size(A,2)) disp("A is Square") end

16 days ago | 0

| accepted

Answered

Showing legend even if data is not there

a=(1:1:9)'; a=reshape(a,3,[]); b=sin(a); c=cos(a); scatter(a,b,'.','DisplayName', 'sin') hold on scatter(a,c,'.','Displa...

Showing legend even if data is not there

a=(1:1:9)'; a=reshape(a,3,[]); b=sin(a); c=cos(a); scatter(a,b,'.','DisplayName', 'sin') hold on scatter(a,c,'.','Displa...

16 days ago | 0

| accepted

Answered

Cell in table data type conversion

a = (1:3)'; b = {'yes', 'no', 'yes'}'; t = table(a,b) t.b = categorical(t.b)=='yes'

Cell in table data type conversion

a = (1:3)'; b = {'yes', 'no', 'yes'}'; t = table(a,b) t.b = categorical(t.b)=='yes'

16 days ago | 0

| accepted

Answered

How can I create a new matrix which stores the diagonals, but it first starts with a matrix full of zeros?

% start with zero matrix n=3; a = zeros(3) % random entries along diagonal a(1:n+1:n*n) = randi(100, [n 1]) % alternative...

How can I create a new matrix which stores the diagonals, but it first starts with a matrix full of zeros?

% start with zero matrix n=3; a = zeros(3) % random entries along diagonal a(1:n+1:n*n) = randi(100, [n 1]) % alternative...

16 days ago | 0

| accepted

Answered

Which is my mistake?

N = 60; n = 0:N-1; b = [0.18 0.1 0.3 0.1 0.18]; a = [1 -1.15 1.5 -0.7 0.25]; %d = delta(n(19n), 0 , n(end)); d = zeros(size...

Which is my mistake?

N = 60; n = 0:N-1; b = [0.18 0.1 0.3 0.1 0.18]; a = [1 -1.15 1.5 -0.7 0.25]; %d = delta(n(19n), 0 , n(end)); d = zeros(size...

22 days ago | 0

| accepted

Answered

How can I display text on pcolor map like in the image below?

L = membrane(1, 100); s=pcolor(L); s.EdgeColor='none'; set(gca, 'YDir', 'reverse') xl = xlim; yl = ylim; n = 1; xy =[]; ...

How can I display text on pcolor map like in the image below?

L = membrane(1, 100); s=pcolor(L); s.EdgeColor='none'; set(gca, 'YDir', 'reverse') xl = xlim; yl = ylim; n = 1; xy =[]; ...

22 days ago | 0

| accepted

Answered

How to change the values of the corners in a matrix

a= zeros(10, 10); % smaller matrix for easy display % for corners a([1 end], [1 end]) = 1; a

How to change the values of the corners in a matrix

a= zeros(10, 10); % smaller matrix for easy display % for corners a([1 end], [1 end]) = 1; a

22 days ago | 0

| accepted

Answered

Why does my code slow down around the 20th iteration?

The recursive function is the culprit of the speed. Simply replace them with mean and var. A_set = []; n=1; while 1==1 %eval...

Why does my code slow down around the 20th iteration?

The recursive function is the culprit of the speed. Simply replace them with mean and var. A_set = []; n=1; while 1==1 %eval...

23 days ago | 0

| accepted

Answered

Plotting with bisection method

Bisection method tries to find solution in a given interval. Generally, you don't know how many roots a non-linear equation has...

Plotting with bisection method

Bisection method tries to find solution in a given interval. Generally, you don't know how many roots a non-linear equation has...

23 days ago | 0

| accepted

Answered

Name table columns with variable index

tab = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/980210/MATWORKS.csv'); head(tab) varnames = ta...

Name table columns with variable index

tab = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/980210/MATWORKS.csv'); head(tab) varnames = ta...

23 days ago | 0

| accepted

Answered

How to save results in a file without overwritting previous results????

Use append option when you save the data to files. [You can also use low-level fopen with option 'a+' for appending] % create ...

How to save results in a file without overwritting previous results????

Use append option when you save the data to files. [You can also use low-level fopen with option 'a+' for appending] % create ...

23 days ago | 0

Answered

Output argument's name same as input argument's

Functionally, they are same. However, some differences may exist: The obvious one is the program style (using input as output ...

Output argument's name same as input argument's

Functionally, they are same. However, some differences may exist: The obvious one is the program style (using input as output ...

24 days ago | 0

Answered

How to output a cell array using fprintf?

% cell array a = {'# To Select', 'Names', 'Barcodes', 'Prices'; 1, 'ABC', 1234, 4.5} fprintf("%s\n", formattedDisplayText(a))

How to output a cell array using fprintf?

% cell array a = {'# To Select', 'Names', 'Barcodes', 'Prices'; 1, 'ABC', 1234, 4.5} fprintf("%s\n", formattedDisplayText(a))

24 days ago | 0

| accepted

Answered

showing empty plot in nexttile or subplot

a = "r"; b="g"; c="b"; d="m"; x{1}=[0.1 0.2 0.3 0.6 0.24 0.67]; y{1}=[2 1 4 7 4 5]; t{1}=[a b a c d b] x{2} = []; y{2} ...

showing empty plot in nexttile or subplot

a = "r"; b="g"; c="b"; d="m"; x{1}=[0.1 0.2 0.3 0.6 0.24 0.67]; y{1}=[2 1 4 7 4 5]; t{1}=[a b a c d b] x{2} = []; y{2} ...

24 days ago | 0

| accepted

Answered

Can writetable delimit strings using single-quotes?

You may not change the quote string with writetable directly. However, you can add a single quote to your string before writing...

Can writetable delimit strings using single-quotes?

You may not change the quote string with writetable directly. However, you can add a single quote to your string before writing...

24 days ago | 0

| accepted

Answered

When i run the code, i dont see any plot, and i'm not sure why?

syms x; increment = 0.0; m=0.5+increment; %Units are in SI Pr=0.718; %Prandtl number rho=1.204...

When i run the code, i dont see any plot, and i'm not sure why?

syms x; increment = 0.0; m=0.5+increment; %Units are in SI Pr=0.718; %Prandtl number rho=1.204...

25 days ago | 0

Answered

automatically scale display range to eliminate outliers

y = randn(50, 50); y (20, 20) = 1e8; % outlier subplot(121) imagesc(y); % outlier removed colorbar subplot(122) imagesc...

automatically scale display range to eliminate outliers

y = randn(50, 50); y (20, 20) = 1e8; % outlier subplot(121) imagesc(y); % outlier removed colorbar subplot(122) imagesc...

25 days ago | 1

| accepted

Answered

Edit legend description and make a dot in on of the character

Try to modify the following: % generate some data data = (1:10)' + randi([3 20], [1 4]); plot(data) legend(["1 $s=u$" "2 $s=...

Edit legend description and make a dot in on of the character

Try to modify the following: % generate some data data = (1:10)' + randi([3 20], [1 4]); plot(data) legend(["1 $s=u$" "2 $s=...

25 days ago | 0

Answered

plotting nonlinear equation along real and imaginary axis

Try the following: Re-arrange the equation so that it is polynomial of complex variable z with coefficients being function of r...

plotting nonlinear equation along real and imaginary axis

Try the following: Re-arrange the equation so that it is polynomial of complex variable z with coefficients being function of r...

25 days ago | 0

| accepted

Answered

sum of dirac delta function

syms x t y(x) = dirac(x-1); for i=4:3:200 y(x) = y(x) + dirac(x-i); end z = y(x)* exp(-4*(t-x)); y z

sum of dirac delta function

syms x t y(x) = dirac(x-1); for i=4:3:200 y(x) = y(x) + dirac(x-i); end z = y(x)* exp(-4*(t-x)); y z

25 days ago | 0

Answered

how to divide the Dataset into xtrain xtest ytrain ytest

% doc cvpartition data = randn(2310, 25); %cv = cvpartition(2310, 'Holdout', 0.3); %idxTrain = training(cv); %idxTest = te...

how to divide the Dataset into xtrain xtest ytrain ytest

% doc cvpartition data = randn(2310, 25); %cv = cvpartition(2310, 'Holdout', 0.3); %idxTrain = training(cv); %idxTest = te...

25 days ago | 1

Answered

need to skip iterations in a for loop

L=zeros(1024,1024); % for n=(2:1022:3) % L(1024,n)=1 % end % Set the last row (first end), column 2 to last column wi...

need to skip iterations in a for loop

L=zeros(1024,1024); % for n=(2:1022:3) % L(1024,n)=1 % end % Set the last row (first end), column 2 to last column wi...

25 days ago | 1

| accepted

Answered

How to calculate the width that contains 60% of the total area of peaks?

load position load Intensity whos plot(x2, Int); hold on % find the max [maxI, idx] = max(Int); maxX = x2(idx) n = length...

How to calculate the width that contains 60% of the total area of peaks?

load position load Intensity whos plot(x2, Int); hold on % find the max [maxI, idx] = max(Int); maxX = x2(idx) n = length...

25 days ago | 0

| accepted

Answered

I need help with plotting

syms t Zc=300; R=100; s=100; v=300/(1*10^-6) tpulssi=s/v k=-1000/tpulssi p=(R-Zc)/(R+Zc) s2=25 tpr=s2/v %heijastuva t...

I need help with plotting

syms t Zc=300; R=100; s=100; v=300/(1*10^-6) tpulssi=s/v k=-1000/tpulssi p=(R-Zc)/(R+Zc) s2=25 tpr=s2/v %heijastuva t...

26 days ago | 1

| accepted

Answered

Assigning same color for same value at different plots

x{1}=[0.1 0.4 0.6 0.8]; y{1}=[0.2 0.3 0.7 0.9]; name{1}=["A" "B" "C" "A"]; x{2}=[0.1 0.2 0.4 0.6 0.5 0.8]; y{2}=[0.2 0.5 ...

Assigning same color for same value at different plots

x{1}=[0.1 0.4 0.6 0.8]; y{1}=[0.2 0.3 0.7 0.9]; name{1}=["A" "B" "C" "A"]; x{2}=[0.1 0.2 0.4 0.6 0.5 0.8]; y{2}=[0.2 0.5 ...

26 days ago | 0

| accepted

Answered

How do I plot a graph for ϴ for a given range of independent variables?

Assume that r, theta, phi are 3d spherical coordinates. theta is elevation and phi is azimuth. The following is the code to pl...

How do I plot a graph for ϴ for a given range of independent variables?

Assume that r, theta, phi are 3d spherical coordinates. theta is elevation and phi is azimuth. The following is the code to pl...

29 days ago | 0

| accepted