Answered
How do I make this ellipse?
t = 0:0.01:2*pi; x = 0.25*cos(t); y = 0.5*sin(t); figure(); plot(x,y); axis square Reference

5 years ago | 1

Answered
Index exceeds the number of array elements
It seems like this: for n=1:size(output,2) should be this: for n=1:size(output1,2)

5 years ago | 1

| accepted

Answered
how to do spline without spline
From the spline documentation page: "You also can perform spline interpolation using the interp1 function with the command inter...

5 years ago | 1

Answered
Weird Behavior Of Replacing Data Array In a Certain Range ...
Any (real) number is either less than 2 or greater than -2 (or both). Therefore detecting_noise_pos | detecting_noise_neg is all...

5 years ago | 0

| accepted

Answered
How do I plot this graph?
Here's one way: x = -10:0.01:10; y = (11*x+2)./(2*x.^3-1); plot(x,y); ylim([-15 15]);

5 years ago | 1

Answered
Undefined operator '.^' for input arguments of type 'cell'. Can someone help me with this?
Replace the curly braces with parentheses: err(n)=(target_sample(n)-output1(n)).^2;

5 years ago | 0

| accepted

Answered
How do I make a graph?
t = 0:0.001:2*pi; x = 3*(t-sin(t)); y = 3*(1-cos(t)); figure(); plot(x,y);

5 years ago | 1

| accepted

Answered
Dynamically naming new table columns in a loop
Use dynamic field names (the documentation is for structs, but it works for tables too (evidently)): VarA1 = [1 2 3].'; VarA2 ...

5 years ago | 1

Answered
Index exceeds the number of array elements (1). Trapezoid Method
On the line before the error line, you have defined h to be a scalar: h=(inter(2)-inter(1))/n; So the next line (the error lin...

5 years ago | 0

Answered
How can I do a Crosscorrelation between a vector and a cell
ns = size(nor_sam,1); nb = size(b_nor,1); hh = cell(ns,nb); lags = cell(ns,nb); for i = 1:ns for j = 1:nb ...

5 years ago | 0

| accepted

Answered
Euler Method Approximation Not Working
Take a look at how the approximation is calculated: w1(k+1)=w1(k+1)+h(k+1)*f(t0,w0); You are always evaluating f at t0,w0.

5 years ago | 1

Answered
Unable to perform assignment because the size of the left side is 1-by-4 and the size of the right side is 1-by-2. How can I resolve this?
Your x is initialized with PD rows and NPE columns: x = zeros(PD,NPE); Then each row of x is calculated and specified to have ...

5 years ago | 0

Answered
Removing blank spaces from data
How about this (the file I'm using is attached - it may not have the exact same format as yours): fid = fopen('GainSweep.txt');...

5 years ago | 0

| accepted

Answered
Calculate the average grade of the class.
function [grade,x] = calculate_grade() % Homework 30% Tests 30% Project 10% Attendance 10% Final 20% % Homework 1=85% Homework...

5 years ago | 0

Answered
Loop machine learning algorithm functions
funcs = {@fitcknn @fitcecoc @fitctree}; n_funcs_given = numel(funcs); A = cell(1,n_funcs_given); for i = 1:n_funcs_given ...

5 years ago | 0

| accepted

Answered
Can someone convert this pseudocode to MATLAB code?
function y = myFFT(a, omega) % Input: An n-length coefficient vector a = [a_0,a_1,...,a_(n-1)] % and a primitive nth ...

5 years ago | 0

Answered
For Loop gets ignored
Maybe this? B1 = []; for l = 1:size(K,1) if BC(l) == 1 B1(end+1) = K{l,1}; end end

5 years ago | 0

Answered
frequency domain to time domain
ifft

5 years ago | 1

Answered
How to select 5 rows from a dataset and load it into a variable?
Since 344777 is not a multiple of 5, it's not clear what should happen when the code gets to the end of the dataset (i.e., opera...

5 years ago | 0

Answered
Index exceeds the number of array elements (1). this error is shown for lz = i_ + E_(a+b+c)*j_ in matlab.....
The expression E_(a+b+c) returns the element of the matrix or vector E_ at index a+b+c. Is this what you intend? Based on th...

5 years ago | 0

Answered
Pass pointer to function as in C
Here is the equivalent MATLAB-style pseudo-code: function vec2 = vec_update(vec1, vec2) vec2(1) = vec1(1) + vec1(2) + ... ...

5 years ago | 0

| accepted

Answered
how can I use sublot in this code, I want to show the three images in one figuare
The code you posted creates 9 figures, each with one image, and it's not clear whether you want to make three figures with three...

5 years ago | 0

Answered
How to make a function with an image input?
To create a function called streakprocess that takes a matrix representing an image as input: function [x,y,z] = streakprocess(...

5 years ago | 0

| accepted

Answered
How can I find all the rows that have a specific value in a specific column of an array?
ex = [0 50 51 52 50 1;0 53 50 52 54 1;0 51 51 54 50 1;0 53 51 52 53 1;0 50 54 52 51 1]; new = ex(ex(:,5) == 50,:)

5 years ago | 0

| accepted

Answered
find all anonymous function in a workspace
% set up some variables in the workspace: f = @(x) x^2 ; g = @(z,y) y^3 + z; a = rand(5,3); b = a.^3 + 5; S = whos()...

5 years ago | 0

Answered
How to use 'for' loop to string variable ?
Here's one way to make a struct array, as intended in the code you posted in your question (note that this just uses two of the ...

5 years ago | 1

Answered
I think I am on the right track...
I ran into an error in the calculation of H3 at the bottom of the loop. Looking into it, it was suspicious to me that H2, H3 and...

5 years ago | 0

| accepted

Answered
How to execute several mat file in a loop.
To have k = 1 correspond to mat file 280, and k = 2 correspond to mat file 300, and so on, you can do this: N=500; mat_file_nu...

5 years ago | 0

| accepted

Answered
Hey i need quick help with a code
I think the problem is an unrecognized input option passed to ezplot3. Specifically, the 10 causes the input argument list to ge...

5 years ago | 0

| accepted

Load more