Solved

Check if number exists in vector

Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

7 months ago

Solved

Swap the first and last columns

Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

7 months ago

Solved

Swap the input arguments

Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

7 months ago

Solved

Column Removal

Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; ...

7 months ago

Solved

Reverse the vector

Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

7 months ago

Solved

Length of the hypotenuse

Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<https://i.imgu...

7 months ago

Solved

Triangle Numbers

Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

7 months ago

Solved

Maximum value in a matrix

Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

7 months ago

Solved

Finding Perfect Squares

Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

7 months ago

Solved

Generate a vector like 1,2,2,3,3,3,4,4,4,4

Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

7 months ago

Solved

Make the vector [1 2 3 4 5 6 7 8 9 10]

In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

7 months ago

Solved

Find the sum of all the numbers of the input vector

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

7 months ago

Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

7 months ago

Solved

Times 2 - START HERE

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

7 months ago

Answered

Making an array using loop

Change ORIGINAL_POST to false to get slightly different result. clearvars; clc; % remove previous debug runs lenA = 60; % as...

Making an array using loop

Change ORIGINAL_POST to false to get slightly different result. clearvars; clc; % remove previous debug runs lenA = 60; % as...

7 months ago | 0

Answered

Reading the matrix elements row wise

If you do not want to take the transpose of the A matrix, you can work with the subscripts instead. A = [1 2 3; 4 5 6]; sz = s...

Reading the matrix elements row wise

If you do not want to take the transpose of the A matrix, you can work with the subscripts instead. A = [1 2 3; 4 5 6]; sz = s...

7 months ago | 1

| accepted

Answered

Getting two outputs when using function with implemented if statement

In your acuteAngle function, there is a disp() line which gives you the first output. The calling routine disp(acuteAngle() give...

Getting two outputs when using function with implemented if statement

In your acuteAngle function, there is a disp() line which gives you the first output. The calling routine disp(acuteAngle() give...

7 months ago | 1

| accepted

Answered

how to mute the signal at a certain time

This will remove all the leading zeros of a Sig vector: Sig = Sig(find(Sig,1,'first'):end);

how to mute the signal at a certain time

This will remove all the leading zeros of a Sig vector: Sig = Sig(find(Sig,1,'first'):end);

7 months ago | 1

Answered

Reading the matrix elements row wise

A = [1 2 3; 4 5 6]; Atr = transpose(A); Atr(1:6) ans = 1 2 3 4 5 6

Reading the matrix elements row wise

A = [1 2 3; 4 5 6]; Atr = transpose(A); Atr(1:6) ans = 1 2 3 4 5 6

7 months ago | 1

Answered

Plotting and finding the intersection of 2 curves

If you have two vectors, x1, y1 that form the curve (x1, y1), and likewise, another curve (x2, y2), then you can get the interse...

Plotting and finding the intersection of 2 curves

If you have two vectors, x1, y1 that form the curve (x1, y1), and likewise, another curve (x2, y2), then you can get the interse...

7 months ago | 0

Answered

Is it possible to have two indices in a for loop?

>> Is it possible to have 2 indices in the same for loop? (i and k). In your i- and k-loops, you are considering every combinat...

Is it possible to have two indices in a for loop?

>> Is it possible to have 2 indices in the same for loop? (i and k). In your i- and k-loops, you are considering every combinat...

7 months ago | 0

Answered

Is it possible to have two indices in a for loop?

Jan's solution appears to not provide all combinations of (i,k) for the 2D array, AEMGstructHR. So I do not see how that constru...

Is it possible to have two indices in a for loop?

Jan's solution appears to not provide all combinations of (i,k) for the 2D array, AEMGstructHR. So I do not see how that constru...

7 months ago | 0

Answered

Frequency and Phase response of an IIR system whose system function is given H(z)

Here is an example to plot the magnitude and phase frequency response >> b = [0.0563 -0.0009 -0.0009 0.0563]; >> a = [1...

Frequency and Phase response of an IIR system whose system function is given H(z)

Here is an example to plot the magnitude and phase frequency response >> b = [0.0563 -0.0009 -0.0009 0.0563]; >> a = [1...

7 months ago | 0

Answered

Solving probability problems with MATLAB

You can simulate this problem using a Monte Carlo Simluation. https://www.mathworks.com/matlabcentral/answers/97605-are-there-a...

Solving probability problems with MATLAB

You can simulate this problem using a Monte Carlo Simluation. https://www.mathworks.com/matlabcentral/answers/97605-are-there-a...

7 months ago | 0

Answered

How to make the estimation error and average it correctly?

for sd = 0:10:50 PN=Po+(sd.*gaussnoise); end In each iteration of this inner loop, PN is computed with a new ...

How to make the estimation error and average it correctly?

for sd = 0:10:50 PN=Po+(sd.*gaussnoise); end In each iteration of this inner loop, PN is computed with a new ...

8 months ago | 0

| accepted

Answered

Is there a way to access a struct object's reference (handle) in MATLAB?

This may be close to what you are looking for. Define a classA.m classdef classA < handle properties a end me...

Is there a way to access a struct object's reference (handle) in MATLAB?

This may be close to what you are looking for. Define a classA.m classdef classA < handle properties a end me...

8 months ago | 0

| accepted

Answered

Removing one of two plots on a single axis

t =0:.01:1; y = sin(2*pi*4*t); hold on; h1 =plot(.2,.5,'ro'); pause delete(h1) Hit a spacebar and the red circle will disap...

Removing one of two plots on a single axis

t =0:.01:1; y = sin(2*pi*4*t); hold on; h1 =plot(.2,.5,'ro'); pause delete(h1) Hit a spacebar and the red circle will disap...

8 months ago | 0

Answered

Compare Matrices within tolerance range

For a tolerance match between corresponding elements of the rows, start off with this: a = a(:); b = b(:); %% Check for equi...

Compare Matrices within tolerance range

For a tolerance match between corresponding elements of the rows, start off with this: a = a(:); b = b(:); %% Check for equi...

8 months ago | 0