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...

22 days ago | 0

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...

25 days ago | 1

| accepted

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...

26 days ago | 0

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

26 days ago | 0

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...

27 days ago | 0

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...

27 days ago | 0

| accepted

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...

27 days ago | 0

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

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

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

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

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

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

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

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

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?

1 month ago | 1

| accepted

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

Computing the Standard Deviation of Values in a column in Matlab
out = std(tablename.Speed(1:15))

1 month ago | 0

| accepted

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

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

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

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

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

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

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

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

How can I make a loop for solving a quadratic equation with 200 different data points and only include the positive values of the quadratic eqaution?
"eqn" is a quadratic equation in x and thus using solve() will give you 2 outputs. But you are trying to assign 2 outputs to one...

1 month ago | 0

How to solve equations in variable terms?
syms a b c d e f g h alpha A = [a b; c d]; R = [cos(alpha) -sin(alpha); sin(alpha) cos(alpha)]; D = (R*A)*transpose(R); ...

1 month ago | 0

| accepted

error in ode45. I have declared the vector to be 3x1 but it only reads it as 2x1.
You get the error because dpdt is empty, and thus dydt is 2x1. Instead of defining kpm as global, it is better to define it as...

1 month ago | 0

| accepted