Answered
how to plot roc?
Perhaps: plotroc?

7 years ago | 0

| accepted

Answered
Multi term power series fitting with MATLAB
Try this: D = load('NoLoadSpeed.mat'); T = load('Time.mat'); NLS = D.MotorSpeed_NoLoad; % Column...

7 years ago | 0

Answered
Calculation of diurnal cycle
Try this: D = readtable('Airport.csv'); Hrs = hour(D.Date); %...

7 years ago | 1

| accepted

Answered
How would i plot the following?
Perhaps: x = linspace(-1,1, 25); y = logspace(-2, 2, 25); [X,Y] = ndgrid(x, y); Z=-log(Y)+5*exp(X); figure mesh(X,Y,Z) ...

7 years ago | 0

Answered
Hello everyone, I wrote a code for computing an equation and plot in 3-D (surf)? but it didn't give me a right answer! what is the problem? Also the plot is attached.
When dealing with arrays, unless you specifically intend too do matrix operations, always use element-wise operations (the dot o...

7 years ago | 1

| accepted

Answered
why do I get Array indices must be positive integers or logical values?
The way you have defined ‘t’, it is not an integer, and the code interprets it as a subscript in lines 17-19. One way to fix ...

7 years ago | 0

Answered
System of differential equations with periodic function in each equation
There are obviously sin calls in ‘crimp’, so that explains the oscillations. The real question is why you are not getting the...

7 years ago | 0

| accepted

Answered
The precision of plot filter design function is different than plot just coefficients of the same function of filter
To reproduce the posted results, plot them as: b = fir1(68,[.35,.65]); bb = round(b, 4); figure freqz(bb,1,512); figur...

7 years ago | 0

| accepted

Answered
Linear interpolation in rows of matrix
The fillmissing function (R2016b and later) will do what you want: D = [1, 2, 3, 4, 5, 6, 7]; V1 = [50, 54, NaN, 62, 62, 64,...

7 years ago | 1

| accepted

Answered
i want to make a plot with "t" to vary in time step
In MATLAB, the explicit loop is not necessary: a = 0.25; x= 3; k=1; sigma = 2.21; t=0:0.01:50; eta = a * sin( ( k * x ) -...

7 years ago | 0

| accepted

Answered
Solving coupled ode in MATLAB
This should get you started: % %function definitions syms r(T) p(T) c E h L m rs T Y ode1 = diff(r,T,2) == E^2 / ((m^2)*(c^...

7 years ago | 7

| accepted

Answered
Broken code on phasor representation
There is a missing single quote disp(['V=',num2str(MagV,'%3.4g'),... exp(',num2str(PhaseVDeg,'%3.4g'),'j)']) ↑ ← HER...

7 years ago | 1

| accepted

Answered
anonymous function and plotting
You are essentially where you want to be. It helps to assign the output of your function to a different variable. (I use ‘v’ h...

7 years ago | 1

| accepted

Answered
How to change ASCII values?
You are not using tthe result of the upper call. See if: u = upper(k) y = double(u) is more appropriate.

7 years ago | 0

Answered
How to vary a value inside an integral which is not getting integrated itself?
The integral2 and integral3 functions do not allow the 'ArrayValued' name-value pair, so it is necessary to ‘nest’ integral call...

7 years ago | 0

| accepted

Answered
how to get best 10 fitness values
If you have R2017b or later, mink would be easiest. Otherwise, use sort and take the first 10. (This assumes that ‘fitness’ is...

7 years ago | 0

| accepted

Answered
stem fuction shows error everytime
You have a script file that you named ‘stem’. This is called ‘overhsadowing’ a MATLAB function. The solution is to find the ...

7 years ago | 0

Answered
Plotting two functions on 3D surface for the same interval
Try this: x = 0:10; Z1=x.^2; Z2=x.^3; figure surf(Z1.'*Z2) Another possibility: figure surf([Z1; Z2]) It is not cer...

7 years ago | 0

| accepted

Answered
Extract values common to 5 columns
Since it is not homework, see if this does what you want: A = randi(9,20,5); % Create Mat...

7 years ago | 0

| accepted

Answered
How to use a vector to index another vector?
Testing the code (without the function definition or function call): t = (0:0.1:15); in = sin(t*2*pi); w = 5; out = in*0;...

7 years ago | 0

Answered
how can i work with two variables with genetic algorithm
It would be helpful to know what your fitness function is doing. If there are independent variables, you can combine them as:...

7 years ago | 0

| accepted

Answered
I want to generate a time vector
start = datetime('6:30 AM', 'InputFormat','h:mm a'); finish = datetime('3:00 PM', 'InputFormat','h:mm a'); interval = minutes(...

7 years ago | 0

| accepted

Answered
Is there a way to set the xticklabel text alignment
The example in Specify x-Axis Tick Values and Labels appear to be centre-aligned.

7 years ago | 0

Answered
If elseif else statement inside a loop
Perhaps: for k = 1:5 YourGrade= input('Enter your number grade:') if YourGrade >= 90; disp('Your grade is a...

7 years ago | 0

Answered
NaN issue when calculating for a mean value
The NaN result is due to one or more elements of the vector you are taking the mean of being (0/0) or (Inf/Inf), since they eval...

7 years ago | 0

Answered
Least squares regression of a quadratic without bx term.
Try this: DM = [x(:).^2 ones(size(x(:)))]; % Design Matrix B = DM \ y(:); ...

7 years ago | 0

| accepted

Answered
FFT analysis of multiple signals with the same response length
The fft function operates column-wise (unless the argument is a vector or you tell it otherwise), so this is all that is necessa...

7 years ago | 1

| accepted

Answered
solving differential equation and assigning value to symfun
Try this: t_val = vpasolve(ySol==1,t) % Symbolic Solution

7 years ago | 0

| accepted

Answered
Solving for a variable in equation
Use a root-finding function (I chose fzero here), then take the known variable values, create an anonymous function from the exp...

7 years ago | 0

| accepted

Answered
How to find data values that falls on line connecting loglog plot in matlab
To get a smooth interpolation, it is necessary to do two transformations on it. First, interpolate log(y), and then take the ex...

7 years ago | 0

| accepted

Load more