Answered

How to format notation to use "... x 10^-5..." instead of "...e..." in this figure

%Random graph syms x fplot(jacobiP(1:4,4,4,x)) axis([-1 2 -5 5]) grid on %Values to be displayed as the legend arr = ran...

How to format notation to use "... x 10^-5..." instead of "...e..." in this figure

%Random graph syms x fplot(jacobiP(1:4,4,4,x)) axis([-1 2 -5 5]) grid on %Values to be displayed as the legend arr = ran...

22 days ago | 1

Answered

If conditions multiple loops

Firstly, if-else condition statements are not loops. Secondly you need to use either "&" or "|" depending upon the how you want...

If conditions multiple loops

Firstly, if-else condition statements are not loops. Secondly you need to use either "&" or "|" depending upon the how you want...

22 days ago | 0

| accepted

Answered

How can I change my O(n^2) solution to O(n logn) or better?

(Assuming you are working with a vector and finding the first pair whose sum is equal to the target) Use logical indexing in th...

How can I change my O(n^2) solution to O(n logn) or better?

(Assuming you are working with a vector and finding the first pair whose sum is equal to the target) Use logical indexing in th...

23 days ago | 0

Answered

How to solve following task?

The values you have add up to 60 and not 65. Total=60; a=28; b=20; c=15; [A,B,C]=meshgrid(0:floor(Total/a), 0:floor(Total...

How to solve following task?

The values you have add up to 60 and not 65. Total=60; a=28; b=20; c=15; [A,B,C]=meshgrid(0:floor(Total/a), 0:floor(Total...

24 days ago | 1

| accepted

Answered

How to plot using peaks function?

You are asked to create a function to evaluate the value at each point pair individually rather than use the peaks() function an...

How to plot using peaks function?

You are asked to create a function to evaluate the value at each point pair individually rather than use the peaks() function an...

25 days ago | 0

Answered

Evaluate an anonymous function for each value in a matrix

"In another implementation like multiplication I would use ".*" to signify elementwise calculations so I am assuming there is so...

Evaluate an anonymous function for each value in a matrix

"In another implementation like multiplication I would use ".*" to signify elementwise calculations so I am assuming there is so...

29 days ago | 1

| accepted

Answered

I keep getting error using plot not enough input arguments.

You need to sort your x data. recallv = cell2mat(recall); precisionv = cell2mat(precision); [r,index] = sort(recallv); p = p...

I keep getting error using plot not enough input arguments.

You need to sort your x data. recallv = cell2mat(recall); precisionv = cell2mat(precision); [r,index] = sort(recallv); p = p...

29 days ago | 0

Answered

Plotting solution curves separately

% Parameters c = 0.0020; a = 0.02; % SIR model (Ordinary Differential Equations) odefcn = @(t,x) [- c*x(1)*x(2); ...

Plotting solution curves separately

% Parameters c = 0.0020; a = 0.02; % SIR model (Ordinary Differential Equations) odefcn = @(t,x) [- c*x(1)*x(2); ...

29 days ago | 0

Answered

How to Integrate specific heat equation on matlab?

You need to define a, b, c, d, e, r as well, either as numerical values or as symbolic variables - %Here I have defined a, b, c...

How to Integrate specific heat equation on matlab?

You need to define a, b, c, d, e, r as well, either as numerical values or as symbolic variables - %Here I have defined a, b, c...

1 month ago | 0

Answered

Is there a Faster alternative to ismember function ?

Generally, using find() and growing variables in a loop tend to cause the code to be slower. Here you can replace find() with lo...

Is there a Faster alternative to ismember function ?

Generally, using find() and growing variables in a loop tend to cause the code to be slower. Here you can replace find() with lo...

1 month ago | 0

| accepted

Answered

Evaluating a function using kramers-kronig relation

You can use symbolic integration (Note - Requires Symbolic Toolbox) As you have not provided the value of P, I've defined it as...

Evaluating a function using kramers-kronig relation

You can use symbolic integration (Note - Requires Symbolic Toolbox) As you have not provided the value of P, I've defined it as...

1 month ago | 0

Answered

How to align X and Y axis to middle of plot?

t = 0:5:360; x = cosd(t); y = sind(t); plot(x,y) hold on %Ellipse xe = 0.5*x; ye = 0.3*y; plot(xe,ye) %Get current axis...

How to align X and Y axis to middle of plot?

t = 0:5:360; x = cosd(t); y = sind(t); plot(x,y) hold on %Ellipse xe = 0.5*x; ye = 0.3*y; plot(xe,ye) %Get current axis...

1 month ago | 0

Answered

I am not able to access MATLAB Fundamentals course

The Self-paced Training App services are down currently. You will be able to login and will be able to access your progress once...

I am not able to access MATLAB Fundamentals course

The Self-paced Training App services are down currently. You will be able to login and will be able to access your progress once...

1 month ago | 0

Answered

mustBeInRange with multiple conditions

The function mustBeInRange itself throws an error if the value is not inside the range n_roof = 10; int_H = [10 13 6]; % Case ...

mustBeInRange with multiple conditions

The function mustBeInRange itself throws an error if the value is not inside the range n_roof = 10; int_H = [10 13 6]; % Case ...

1 month ago | 0

Answered

Unrecognized function or variable 'arma'

Given the syntax used, arma is a function, but it is not an inbuilt function. Do you have a function defined as arma? If yes, i...

Unrecognized function or variable 'arma'

Given the syntax used, arma is a function, but it is not an inbuilt function. Do you have a function defined as arma? If yes, i...

1 month ago | 0

| accepted

Answered

I am having problem with chapter 15(15.2) Vectorizing the Comparison Function in Matlab fundamentals course.

You are currently on the isequaltol_vec.mlx page. You need to go to the comparewithtol.mlx script page and write the code there...

I am having problem with chapter 15(15.2) Vectorizing the Comparison Function in Matlab fundamentals course.

You are currently on the isequaltol_vec.mlx page. You need to go to the comparewithtol.mlx script page and write the code there...

1 month ago | 0

Answered

How to create string of text-objects

Given the format of your final output, you will either have to use string arrays, cell arrays or categorical arrays. %Categoric...

How to create string of text-objects

Given the format of your final output, you will either have to use string arrays, cell arrays or categorical arrays. %Categoric...

1 month ago | 1

Answered

Multiple integrals with 2 definite integral and 2 symbolic result, how can I get it?

The sytanx you used was incorrect, the correct syntax is - int(Integrand, Integration Variable, Limits of Integration) syms a b...

Multiple integrals with 2 definite integral and 2 symbolic result, how can I get it?

The sytanx you used was incorrect, the correct syntax is - int(Integrand, Integration Variable, Limits of Integration) syms a b...

1 month ago | 1

| accepted

Answered

How to access data of regexp output (without temporary variable)?

Experimenting lead to this - str = ["apple 001"; "banana 102 3579"; "orange 344 001"] C = array2table([extractBefore(str,' ') ...

How to access data of regexp output (without temporary variable)?

Experimenting lead to this - str = ["apple 001"; "banana 102 3579"; "orange 344 001"] C = array2table([extractBefore(str,' ') ...

1 month ago | 1

Answered

How to combine 2 single column variables in to 1 double column variable and output it to a csv or txt file with a header for each column?

var1 = rand(262144,1); var2 = rand(262144,1); T = table(var1,var2,'VariableNames',{'header1', 'header2'}); writetable(T,'file...

How to combine 2 single column variables in to 1 double column variable and output it to a csv or txt file with a header for each column?

var1 = rand(262144,1); var2 = rand(262144,1); T = table(var1,var2,'VariableNames',{'header1', 'header2'}); writetable(T,'file...

1 month ago | 1

| accepted

Answered

Using a range as an input value in symbolic equations

You get the error because A is 1x2 and x is 1x1 and you can not multiply 1x2 to 1x1. Now you would think of changing the order, ...

Using a range as an input value in symbolic equations

You get the error because A is 1x2 and x is 1x1 and you can not multiply 1x2 to 1x1. Now you would think of changing the order, ...

1 month ago | 0

| accepted

Answered

Computing the Standard Deviation of Values in a column in Matlab

out = std(tablename.Speed(1:15))

Computing the Standard Deviation of Values in a column in Matlab

out = std(tablename.Speed(1:15))

1 month ago | 0

| accepted

Answered

How to create array while using integral function?

%Formatting your code properly is a good coding practice K1=6; %(W/m.K)Thermal conductivity of Fe3O4 nanopa...

How to create array while using integral function?

%Formatting your code properly is a good coding practice K1=6; %(W/m.K)Thermal conductivity of Fe3O4 nanopa...

1 month ago | 0

Answered

Rainfall Accumulation Event Based

%Added values at end points y = [-6 -8 -10 0 1 1 2 0 0 0 0 2 4 5 2 0 0 3 5 7]; for k=2:numel(y) if y(k-1) && y(k) ...

Rainfall Accumulation Event Based

%Added values at end points y = [-6 -8 -10 0 1 1 2 0 0 0 0 2 4 5 2 0 0 3 5 7]; for k=2:numel(y) if y(k-1) && y(k) ...

1 month ago | 0

| accepted

Answered

Question about aligning x-axes in subplots on the same row in Matlab

One way to achieve this is to modify y-limits. figure x = linspace(0,10,1e3); subplot(2,2,1) y1 = sin(x); plot(x,y1) y...

Question about aligning x-axes in subplots on the same row in Matlab

One way to achieve this is to modify y-limits. figure x = linspace(0,10,1e3); subplot(2,2,1) y1 = sin(x); plot(x,y1) y...

1 month ago | 0

Answered

Live script plots not showing or overwriting

clc; clear all; close all; This is the root of your problem, this line clears all the data, variables, plots etc (basically any...

Live script plots not showing or overwriting

clc; clear all; close all; This is the root of your problem, this line clears all the data, variables, plots etc (basically any...

1 month ago | 0

| accepted

Answered

Function to find vertex of graph?

m = 2.5; % kg k = 6e6; % N/m c = 180; % N-s/m r = 0:0.01:2; Wn = sqrt(k/m); % rad/s zeta = c / (2*sqrt(k*m)); ...

Function to find vertex of graph?

m = 2.5; % kg k = 6e6; % N/m c = 180; % N-s/m r = 0:0.01:2; Wn = sqrt(k/m); % rad/s zeta = c / (2*sqrt(k*m)); ...

1 month ago | 0

| accepted

Answered

How to stop pi appearing as a text in the disp result?

Convert the symbolic value to floating point value - format long syms x f = cos(x); t6 = taylor(f,x); val = double(subs(t6,...

How to stop pi appearing as a text in the disp result?

Convert the symbolic value to floating point value - format long syms x f = cos(x); t6 = taylor(f,x); val = double(subs(t6,...

1 month ago | 0

| accepted

Answered

How to do moving average for x and y data points in a scatter plot?

It's not clear to me what exactly do you want to achieve. You say 10 points, but you use N=8. "I want to see how moving avera...

How to do moving average for x and y data points in a scatter plot?

It's not clear to me what exactly do you want to achieve. You say 10 points, but you use N=8. "I want to see how moving avera...

1 month ago | 0

| accepted

Answered

I am getting "Conversion to logical from table is not possible." error, how do you solve it?

The input data to writetable() is supposed to be a table, which is not in this case. Use readmatrix and writematrix instead. An...

I am getting "Conversion to logical from table is not possible." error, how do you solve it?

The input data to writetable() is supposed to be a table, which is not in this case. Use readmatrix and writematrix instead. An...

1 month ago | 0