Answered
error statement is not inside anny function
Any functions defined in a script must be at the end of the script. Also, the function monteCarloSimulation_withProjection is d...

2 years ago | 0

Answered
hold on/off for loglog axes
You can use colororder paired with RGB Triplets - x = logspace(-1,2); y1 = 10.^x; y2 = 1./10.^x; y3 = 1.^x; figure log...

2 years ago | 0

| accepted

Answered
Why is this loop faster than a vectorised version? Could the vectorised version be made faster than the loop?
Ideally, timeit should be used over tic-toc to get a more accurate idea of run times of the codes. tic-toc is generally used for...

2 years ago | 0

| accepted

Answered
Not enough input arguments ode45
I am not sure how the different symbolic variables and expressions come into play here for solving the ODE. Nonetheless, Any fu...

2 years ago | 0

Answered
Find the amount of graph intersections
You can utilize this FEX Submission - https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?s_tid=ta_fx_...

2 years ago | 0

| accepted

Answered
Drawing line chart in EXCEL from Matlab and bridging the missing values(NaN)
You can interpolate the missing data via fillmissing and then plot - data = readmatrix('filename.extension'); %Linear inter...

2 years ago | 0

Answered
Check if the multiple 1x2 arrays contained within a 4x2 array exist within a larger 10x2 array
a1 = [1, 5, 4, 3; 3, 4, 7, 1] b1 = [5,4,1,3,7,1,9,5,8,3; 4,7,3,1,5,6,3,9,5,3] [out, idx] = ismember(a1.', b1.', 'rows')

2 years ago | 1

Answered
How to create a complex transfer function?
You need to provide the multiplication operator. And close the parenthesis properly. Computers don't understand that two param...

2 years ago | 1

| accepted

Answered
piecewise function and function handles
You need to define multiple conditions separately/individually i.e - This (0<= wave_angle <= pi-E_2rad) should be - (wav...

2 years ago | 0

| accepted

Answered
Multiple Lines in a Stacked Plot
If you are working with R2018b or a later version, check out stackedplot %Random data n = 10; t = (1:n).'; a = zeros(n,1); ...

2 years ago | 1

| accepted

Answered
How would I plot this and then achieve minimum and maximum.
Look into Array vs Matrix Operations max, min - for global extremum islocalmax, islocalmin - for local extremum

2 years ago | 0

Answered
'tabulate' function
tabulate is a part of the Statistics and Machine Learning Toolbox. To access the function, you need to download and install the ...

2 years ago | 1

| accepted

Answered
How to concatenate the data in each iteration in the same variable?
Firstly, you don't need to use find(), logical indexing is going to be faster. As for storing the data, You can preallocate a c...

2 years ago | 0

Answered
如何使此程序正常运行?
As the error states, The function interp1() expects the length of the first input to be equal to the number of rows in the secon...

2 years ago | 1

| accepted

Answered
Is there any possible to save the logical image in png?
The variable mask() is already a logical array. You don't need to convert it to logical(). Just write it as a PNG image - fon...

2 years ago | 0

| accepted

Answered
delete the third dimension in 4D matrix
You are not accessing the data stored in the struct properly. You need to use the fieldname of the corresponding data to access ...

2 years ago | 0

| accepted

Answered
Can someone check whether my script is correct or not? I did this using the same method as the one last time.
There was a missing element-wise operator in the sin() in the definition of 'k'. Also, I have modified the legend to show the e...

2 years ago | 1

| accepted

Answered
find element egual to substring in array string
From what I understood of the given information - %Input c=["A1_asd";"A2_rrd";"A_dj";"B1_gre";"B2_rffe";"B3_rffe"] %Output...

2 years ago | 0

| accepted

Answered
Why am I getting this error?
There is a missing operator between Ra and (2*L-x) in the else statement block - Update the code accordingly. %% vvv...

2 years ago | 0

Answered
double integration of function handles with two different variables
You need to use element-wise operations to define the integrand - From the documentation of integral2, the definition of the 1...

2 years ago | 0

| accepted

Answered
Help With for loop with tranfer function and step
There is no field in the struct 'S' with name 'T'. Thus you get the error in the line you defined 'S'. I suspect that you want ...

2 years ago | 1

Answered
I'm calculating using the order 3 polynomial interpolation method. But why does an array appear?
The syntax for defining an anonymouts function is incorrect in your code. Also, you are trying to take logarithm of 0, which do...

2 years ago | 0

Answered
I am trying to plot a series, with multiple variables.
Firstly - To use "n" as a symbolic variable, you will have to define it as a symbolic variable. Secondly, you have mentioned to...

2 years ago | 0

Answered
Can you answer why am I getting this error. What should Ido? The error says 'Unrecognised variable z'.
"Can you answer why am I getting this error." Because "z" has not been defined. Two things - Firstly, you are assuming that ...

2 years ago | 0

Answered
Derivative not working plot
Because x_q is empty, thus q is also empty. And plotting empty arrays leads to empty figures. a = -2.914e-07; b = 0.002246; c...

2 years ago | 0

| accepted

Answered
Revolve a Plot around y axis to generate a 3D plot
%2D Data n = 100; theta = linspace(-pi/2,pi/2,n); a=.75; b=.25; X=a*cos(theta); Y=b*sin(theta); %plot the 2D curve fig...

2 years ago | 0

Answered
Indexing with min and numel
[n,I] = min([numel(vector1),numel(vector2)]) There are 2 elements in the input array, as numel() returns a scalar value. Then ...

2 years ago | 2

| accepted

Answered
How to efficiently calculate a weighted sum of 3 dimensional matrix through a vector in matlab
%Random data A = rand(3,4,5); b = rand(5,1); C = sum(A.*reshape(b,1,1,[]), 3)

2 years ago | 0

Answered
Matlab function assumed inputs
Yes, use varargin with nargin - [x1,y1] = pricingprogramme(5,10) [x2,y2] = pricingprogramme(1,2,3,4) function [x,y] = pricin...

2 years ago | 0

| accepted

Answered
How manage for loop to calculate distances?
As the goal here is to find the distance between consecutive points - %Data lat= [-8, -8.2, -8.21, -8.34, -8.9]; long = [-18...

2 years ago | 0

| accepted

Load more