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

alrededor de 1 mes ago

Answered

How to plot every column of matrix into a different graphic but in one figure

% let us suppose your matrix is A,and you want toplot all the columns of A with espect to dome other variable. You havent mentio...

How to plot every column of matrix into a different graphic but in one figure

% let us suppose your matrix is A,and you want toplot all the columns of A with espect to dome other variable. You havent mentio...

2 meses ago | 1

Answered

Comparing two arrays +

clc clear all a=[10 20 30 40]; b=[20 30 30 10]; for i=1:length(a) if a(i)>=b(i) c(i)=a(i); else ...

Comparing two arrays +

clc clear all a=[10 20 30 40]; b=[20 30 30 10]; for i=1:length(a) if a(i)>=b(i) c(i)=a(i); else ...

2 meses ago | 0

Answered

Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm,

function [mmr,mmm] = minimax(M) a=max(M'); b=min(M'); mmr=a-b; c=max(a); d=min(b); mmm=c-d; end % This is what i came up...

Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm,

function [mmr,mmm] = minimax(M) a=max(M'); b=min(M'); mmr=a-b; c=max(a); d=min(b); mmm=c-d; end % This is what i came up...

2 meses ago | 3

Answered

How can we store many matrices(z) from for loop in a single matrix D(say) in my problem.

% If you want your matrices z1,z2,z3 to be stored in side by side ie D=[z1 z2 z3] the following code helps clc clear all x=[1...

How can we store many matrices(z) from for loop in a single matrix D(say) in my problem.

% If you want your matrices z1,z2,z3 to be stored in side by side ie D=[z1 z2 z3] the following code helps clc clear all x=[1...

3 meses ago | 1

Solved

Magic is simple (for beginners)

Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

3 meses ago

Solved

Make a random, non-repeating vector.

This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

3 meses ago

Solved

Four digit number ABCD reversal

write a MATLAB function to find the four-digit number ABCD when multiplied by 4 returns DCBA. The function takes an input x=4.

3 meses ago

Problem

Four digit number ABCD reversal

write a MATLAB function to find the four-digit number ABCD when multiplied by 4 returns DCBA. The function takes an input x=4.

3 meses ago | 0

Solved

Number of o rderd pairs of integers (I,J) that can be formed.

Write a MATLAB function that calculates the number of ordered pairs of integers (I, J) that can be formed satisfying the condit...

3 meses ago

Solved

Ordered pairs of integers (I, J).

Write a MATLAB function that calculates the number of ordered pairs of integers (I, J) that can be formed satisfying the conditi...

3 meses ago

Problem

Ordered pairs of integers (I, J).

Write a MATLAB function that calculates the number of ordered pairs of integers (I, J) that can be formed satisfying the conditi...

3 meses ago | 0

Problem

Number of o rderd pairs of integers (I,J) that can be formed.

Write a MATLAB function that calculates the number of ordered pairs of integers (I, J) that can be formed satisfying the condit...

3 meses ago | 0

Answered

Create a matrix with only the rows indexed by a multiple of N of another matrix.

clc clear all x1=randi([0,10],[9,2]) x2=[] for i=1:3:length(x1) x2=[x2; x1(i,:)] end % this will work

Create a matrix with only the rows indexed by a multiple of N of another matrix.

clc clear all x1=randi([0,10],[9,2]) x2=[] for i=1:3:length(x1) x2=[x2; x1(i,:)] end % this will work

3 meses ago | 1

Solved

Find the sides of an isosceles triangle when given its area and height from its base to apex

Find the sides of an isosceles triangle when given its area and the height from its base to apex. For example, with A=12 and ...

3 meses ago

Solved

Height of a right-angled triangle

Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...

3 meses ago

Solved

Find my daddy long leg (No 's')

Given the ratio of the two legs (longer / shorter), and the hypotenuse length, find the value of the bigger leg.

3 meses ago

Solved

Calculate the area of a triangle between three points

Calculate the area of a triangle between three points: P1(X1,Y1) P2(X2,Y2) P3(X3,Y3) these three points are the vert...

3 meses ago

Solved

Determine if input is odd

Given the input n, return true if n is odd or false if n is even.

3 meses ago

Answered

Fibonacci sequence with loop

clc clear all Fibonacci(1000) function fibn=Fibonacci(n) fibn=[1 1]; i=3; while fibn(i-1)<n fibn(i)=fibn(i-2)+fibn(i-...

Fibonacci sequence with loop

clc clear all Fibonacci(1000) function fibn=Fibonacci(n) fibn=[1 1]; i=3; while fibn(i-1)<n fibn(i)=fibn(i-2)+fibn(i-...

3 meses ago | 1

| accepted

Answered

Fibonacci sequence with loop

clc clear all Fibonacci(10) function fibn=Fibonacci(n) % we are defining a function Fibonacci fibn=[1 1] ...

Fibonacci sequence with loop

clc clear all Fibonacci(10) function fibn=Fibonacci(n) % we are defining a function Fibonacci fibn=[1 1] ...

3 meses ago | 0

Answered

I need help with for loops

clc clear all A = [-100 20 50 -2 -55 3 40 -27] for i = 1:length(A) if A(i) > 0 B(i) = {'true'}; else ...

I need help with for loops

clc clear all A = [-100 20 50 -2 -55 3 40 -27] for i = 1:length(A) if A(i) > 0 B(i) = {'true'}; else ...

3 meses ago | 0

Answered

I need help with for loops

clc clear all A = [-100 20 50 -2 -55 3 40 -27] B=zeros(1,length(A)) for i = 1:length(A) if A(i) > 0 B(i) = tru...

I need help with for loops

clc clear all A = [-100 20 50 -2 -55 3 40 -27] B=zeros(1,length(A)) for i = 1:length(A) if A(i) > 0 B(i) = tru...

3 meses ago | 0

Answered

How to Log10 X and Y

clc clear all x=[1 2 3 4] y=[5 7 9 9] log10(x) log10(y) this code worked well. Your question is littel bit concusing. I...

How to Log10 X and Y

clc clear all x=[1 2 3 4] y=[5 7 9 9] log10(x) log10(y) this code worked well. Your question is littel bit concusing. I...

3 meses ago | 1

| accepted

Answered

How can I plot 3 variables on y axis for the same variable on x axis in one plot?

you can use " hold on " command. you can write your code in the following manner. plot(x,y1) hold on plot(x,y2) hold on pl...

How can I plot 3 variables on y axis for the same variable on x axis in one plot?

you can use " hold on " command. you can write your code in the following manner. plot(x,y1) hold on plot(x,y2) hold on pl...

3 meses ago | 0

Solved

Create times-tables

At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

3 meses ago

Solved

Determine whether a vector is monotonically increasing

Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

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

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

3 meses ago