Programming in MATLAB applied to interdisciplinary engineering fields

Answered

Multiples traces overlapping on multiple subplots

clear clc K = rand(16,800,40); for i = 1:16 subplot(16,1,i) % subplot(4,4,i) for j = 1:40 plot(K(i,:,j),'b-','linewi...

Multiples traces overlapping on multiple subplots

clear clc K = rand(16,800,40); for i = 1:16 subplot(16,1,i) % subplot(4,4,i) for j = 1:40 plot(K(i,:,j),'b-','linewi...

24 days ago | 1

| accepted

Answered

How to fill grids?

clear clc x = 0:30; y = ones(1,length(x))*202 ylim(([0 1600])) plot(x,y,'b--','linewidth',4) xx = [0 30 30 0]; yy = [0 0 ...

How to fill grids?

clear clc x = 0:30; y = ones(1,length(x))*202 ylim(([0 1600])) plot(x,y,'b--','linewidth',4) xx = [0 30 30 0]; yy = [0 0 ...

24 days ago | 0

| accepted

Answered

How do I integrate two columns of discrete data？i need do operations between the data

for i=1:n % step=1 % F=x/y*(x+y); p(i)=(x(i)/y(i)*(x(i)+y(i)))/20;% frenquency=20 end P = sum(p); % use sum outside of loop ...

How do I integrate two columns of discrete data？i need do operations between the data

for i=1:n % step=1 % F=x/y*(x+y); p(i)=(x(i)/y(i)*(x(i)+y(i)))/20;% frenquency=20 end P = sum(p); % use sum outside of loop ...

24 days ago | 0

| accepted

Answered

How to create a column table

vel=linspace(60,140,5); time=[1:0.5:3]; table(time.',vel.','VariableNames',{'Time','Velocity'}) Use transpose .' operator

How to create a column table

vel=linspace(60,140,5); time=[1:0.5:3]; table(time.',vel.','VariableNames',{'Time','Velocity'}) Use transpose .' operator

24 days ago | 1

| accepted

Answered

Merge Three Figures Into One

clear all; clc; hi=5.5*1e6; %heat input=5.5*10^(-6) Btu/h time=4200; %time=4200 hours cost=[4*1e-6,5*1e-6,6*1e-6]; %cost is ...

Merge Three Figures Into One

clear all; clc; hi=5.5*1e6; %heat input=5.5*10^(-6) Btu/h time=4200; %time=4200 hours cost=[4*1e-6,5*1e-6,6*1e-6]; %cost is ...

24 days ago | 1

| accepted

Answered

Loop on two matrices

clear TTB = [207;92;133;1;99;1;127;197;228;42] TL =[21;36;31;8;34;22;14;34;4;51] i = 1; for j = 1:length(TTB) while i<=...

Loop on two matrices

clear TTB = [207;92;133;1;99;1;127;197;228;42] TL =[21;36;31;8;34;22;14;34;4;51] i = 1; for j = 1:length(TTB) while i<=...

25 days ago | 0

Answered

How to display the correct output of the product of matrix correctly when i wanted to conver degrees to radians

prompt = 'Enter the numbers for conversion? '; x = input(prompt) y = x*(pi./180); % formula to convert degrees to radians fpr...

How to display the correct output of the product of matrix correctly when i wanted to conver degrees to radians

prompt = 'Enter the numbers for conversion? '; x = input(prompt) y = x*(pi./180); % formula to convert degrees to radians fpr...

25 days ago | 0

| accepted

Answered

How can I plot the uploaded csv file for each X value there are different Y values. as X = row 1 and Y = column 2 to 6? shown that in color waves .

clear A= xlsread('work.csv') plot(A(1,:),A(2:end,:),'linewidth',2)

How can I plot the uploaded csv file for each X value there are different Y values. as X = row 1 and Y = column 2 to 6? shown that in color waves .

clear A= xlsread('work.csv') plot(A(1,:),A(2:end,:),'linewidth',2)

26 days ago | 0

| accepted

Answered

Plotting discrete piecewise function

x = @(n) 3*((0<=n) & (n<=5)) + (2*n).*(n==6 | n==9) + (2*n+1).*(n > 6 & n< 9) + 0*((n<0) & (n>9)); n = -12:12; figure stem(n,...

Plotting discrete piecewise function

x = @(n) 3*((0<=n) & (n<=5)) + (2*n).*(n==6 | n==9) + (2*n+1).*(n > 6 & n< 9) + 0*((n<0) & (n>9)); n = -12:12; figure stem(n,...

26 days ago | 0

Answered

How to use fill3 to make a box

X= [1 26 26 1] Y= [0.5 .5 25.5 25.5] Z= [0 0 0 0] fill3 (X, Y, Z, 'blue') ; hold on X1= [1 26 26 1] Y1= [0.5 .5 25.5 ...

How to use fill3 to make a box

X= [1 26 26 1] Y= [0.5 .5 25.5 25.5] Z= [0 0 0 0] fill3 (X, Y, Z, 'blue') ; hold on X1= [1 26 26 1] Y1= [0.5 .5 25.5 ...

27 days ago | 0

Answered

the following code is to get neural network output in term of weights and biases for one single output how i can rewirte the code for neural network with 2 outputs

Y11a=w2(1,:)*Y1+b2(1,:); % A vector of values Y2a(1:j)=purelin(Y11a); % Y11a is a vector Y11b=w2(2,:)*Y1+b2(2,:); % ... vect...

the following code is to get neural network output in term of weights and biases for one single output how i can rewirte the code for neural network with 2 outputs

Y11a=w2(1,:)*Y1+b2(1,:); % A vector of values Y2a(1:j)=purelin(Y11a); % Y11a is a vector Y11b=w2(2,:)*Y1+b2(2,:); % ... vect...

27 days ago | 0

Answered

How to generate a square wave with specif values

<https://in.mathworks.com/help/signal/ref/square.html> Try this function in the above link

How to generate a square wave with specif values

<https://in.mathworks.com/help/signal/ref/square.html> Try this function in the above link

28 days ago | 0

Answered

How do I plot this curve?

syms x y f = @(x,y) y.*(1+0.5*y)-x.^2; fplot(f(x,10),[-pi pi]) You could also use fplot function as well

How do I plot this curve?

syms x y f = @(x,y) y.*(1+0.5*y)-x.^2; fplot(f(x,10),[-pi pi]) You could also use fplot function as well

29 days ago | 0

Answered

Looking to plot yaw motion of an aircraft but get "Array indices must be positive integers or logical values." Error

%true Phi = beta.*(1-(omega_n/omega_d.*exp(-sigma.*t).*cos((omega_d.*t)-phi)))

Looking to plot yaw motion of an aircraft but get "Array indices must be positive integers or logical values." Error

%true Phi = beta.*(1-(omega_n/omega_d.*exp(-sigma.*t).*cos((omega_d.*t)-phi)))

29 days ago | 0

Answered

Error using tabular/plot too many input arguments

%f true plot(table2array(x),table2array(y))

Error using tabular/plot too many input arguments

%f true plot(table2array(x),table2array(y))

29 days ago | 1

Answered

Trying to plot a function of time while a variable changes values at different time intervals

clear all clc L_phi = -2.729; L_sigma_a = -43.692; lambda = L_phi; tau = 1/L_phi; t = [0:0.01:5]; for i = 1:length(t) i...

Trying to plot a function of time while a variable changes values at different time intervals

clear all clc L_phi = -2.729; L_sigma_a = -43.692; lambda = L_phi; tau = 1/L_phi; t = [0:0.01:5]; for i = 1:length(t) i...

30 days ago | 0

Answered

Why am I getting the error that the 'dimensions of arrays concatenated are not consistent'?

%f true u10_date=[u10_date date]; By default the arrays are in columns in MATLAB. So as loop increments are done the a...

Why am I getting the error that the 'dimensions of arrays concatenated are not consistent'?

%f true u10_date=[u10_date date]; By default the arrays are in columns in MATLAB. So as loop increments are done the a...

1 month ago | 0

Answered

plotting data of different x values but same number of data points on the same plot

%if true plot(airGa(:,1),airGa(:,3),'Color',c(10,:)) hold on plot(vacuuminitial550mbarGa(:,1),vacuuminitial550mbarGa(:,3),'...

plotting data of different x values but same number of data points on the same plot

%if true plot(airGa(:,1),airGa(:,3),'Color',c(10,:)) hold on plot(vacuuminitial550mbarGa(:,1),vacuuminitial550mbarGa(:,3),'...

1 month ago | 0

Answered

How to change the answer into decimals

_poly2sym_ converts numeric vector to vector of symbolic equation and by default it uses the variable x. The values in vector ...

How to change the answer into decimals

_poly2sym_ converts numeric vector to vector of symbolic equation and by default it uses the variable x. The values in vector ...

1 month ago | 0

| accepted

Answered

Why won't my linear regression line show?

%if true plot(t(:, 2),t.*theta, '--', "LineWidth", 1); What is size of matrix theta? Also use element matrix multiplicati...

Why won't my linear regression line show?

%if true plot(t(:, 2),t.*theta, '--', "LineWidth", 1); What is size of matrix theta? Also use element matrix multiplicati...

1 month ago | 0

Answered

How can I change the line color in an 'animatedline' plot in a manner that scales with one of the variables?

Put _drawnow_ inside the loop

How can I change the line color in an 'animatedline' plot in a manner that scales with one of the variables?

Put _drawnow_ inside the loop

1 month ago | 0

Answered

read the first 3 lines of a file and extract variables without reading the rest

Use _textscan_ <https://in.mathworks.com/help/matlab/ref/textscan.html>

read the first 3 lines of a file and extract variables without reading the rest

Use _textscan_ <https://in.mathworks.com/help/matlab/ref/textscan.html>

1 month ago | 0

Answered

nested loops for 2 different variables

%if true clc;clear; a=0; c= linspace(200,1200,20); l= linspace(1,7,length(c)); for i=1:length(c) Cc(i) = (10*c(i))...

nested loops for 2 different variables

%if true clc;clear; a=0; c= linspace(200,1200,20); l= linspace(1,7,length(c)); for i=1:length(c) Cc(i) = (10*c(i))...

1 month ago | 0

| accepted

Answered

In an assignment A(I) = B, the number of elements in B and I must be the same

What is size of time _t_ in the %true f_glukosa = omin*sin(6*pi*t)

In an assignment A(I) = B, the number of elements in B and I must be the same

What is size of time _t_ in the %true f_glukosa = omin*sin(6*pi*t)

1 month ago | 0

Answered

how do i combine two bar graphs

%true legend(app.CasosUIAxes,[b1 b2],{'Bar Chart 1','Bar Chart 2'}) Use {} for combining bar graph

how do i combine two bar graphs

%true legend(app.CasosUIAxes,[b1 b2],{'Bar Chart 1','Bar Chart 2'}) Use {} for combining bar graph

1 month ago | 0

Answered

Reynolds number, FalsePosition getting multiple errors with no output

%if true for i = 1:numel(Re) % change this line

Reynolds number, FalsePosition getting multiple errors with no output

%if true for i = 1:numel(Re) % change this line

1 month ago | 0

Answered

No connecting lines in plots

%if true nEE(P_B) = R_T/P_T; plot(1:P_B,nEE(1:P_B),'r*-') Modify these lines

No connecting lines in plots

%if true nEE(P_B) = R_T/P_T; plot(1:P_B,nEE(1:P_B),'r*-') Modify these lines

1 month ago | 0

Answered

setting the limits for negative values for colormap

%if true ax = gca; ax.CLim = [abs(min(C{g,1}(:,1))) abs(max(C{g,1}(:,1)))]; Use abs for positive values

setting the limits for negative values for colormap

%if true ax = gca; ax.CLim = [abs(min(C{g,1}(:,1))) abs(max(C{g,1}(:,1)))]; Use abs for positive values

1 month ago | 0