Solved


Ramanujan's Number
About 1729 1729 is the first positive integer which can be expressed as the sum of two positive cubes in two different ways. ...

4 years ago

Solved


Check if a matrix Diagonal is equal to its secondary diagonal
Your function should return True if the secondary diagonal is equal to diagonal, and False otherwise. Eg: M = [1 2 1 ...

4 years ago

Solved


Area of a regular hexagon
Given the length of a side of a regular hexagon, return its area rounded to two decimal places.

4 years ago

Solved


Get the n-th rand number with given seed
Given seed s, return the n-th rand number using rand(). Round the answer with 4 digits. n is a postive integer.

4 years ago

Problem


Determine Poker Hand Winner
Determine the poker hand winner from two hands of cards (each hand will contain the same number of cards between five and thirte...

4 years ago | 1 | 5 solvers

Answered
How to generate a matrix with entries of -1 and +1 of size N x M where all the columns are unique ?
M=10;N=7; m=unique((-1).^randi(2,2*M,N),'rows')'; m=m(1:N,1:M);

4 years ago | 0

Answered
A for loop that finds multiples of certain numbers in a given range
y=[]; for k = 1:100 if mod(k,3)==0||mod(k,5)==5 y=[y,k]; end end y

4 years ago | 0

| accepted

Answered
How to flip a signal ?
plot(abs(P_acc_y_cycle{i}-10)-10,'r') ;

4 years ago | 0

Answered
why do i get this mesage array indices must be positive integers or logical values when trying to define the following function
x=linspace(0,3*pi,1000); f=exp(-x/2).*cos(2*x); plot(x,f,'--b')

4 years ago | 0

| accepted

Solved


Draw 'Y'
Draw 'Y' in an x-by-x matrix (where x is odd and x >= 3) Examples: x = 3 y = [1 0 1 0 1 0 0 1 0] x = 5 y = [1...

4 years ago

Solved


Draw the symbol '+'
Draw '+' in an x-by-x matrix (where x is odd and x >3) Example: x = 5 y = [0 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 ...

4 years ago

Solved


Add the number of horizontal and vertical movements to each matrix element
Given n, create a square matrix and with element (1,1) = 1, add 1 to each element for each horitizonal and vertical movement. E...

4 years ago

Answered
how to plot x(t) vs t when equation is x = 60+30sin(wt) (w=1 and t is a uniform random variable)
w=1; t=30.01:0.01:89.99; X=60+30*w*sind(w*t*2*pi);%you likely want sind (degrees not radians) figure(1); title('Graph of X(t...

4 years ago | 0

Answered
How to multiply two matrix in such a way that I can store individual values of the matrix
x=20:75; X=[cosd(x).*sind(x); sind(x).*cosd(x)].*[1; 2];

4 years ago | 0

Answered
How to remove the 1st, 2nd, 3rd, and 5th row and column from the original matrix and not the newly made one.
No for-loop needed. Kr(BC(:,1), :)=[]; Force_r(BC(:,1), :)=[]; Kr(:,BC(:,1))=[];

4 years ago | 1

| accepted

Solved


Probability of red tulips (at both ends of a row)
I planted tulip bulbs in a row on my flower bed. I thought that I had planted white tulips all. However, later, it turned out t...

4 years ago

Solved


Delete the column with all 0 in the TABLE
In the given table (T), delete the column with all 0 data. e.g. input Banana Apple Orange Mellon __...

4 years ago

Answered
How to shade a portion of a graph
x=[-3:.1:3]; % Y=normpdf(x,0,1); plot(x,Y,'b') xlim([-3 3]) ylim([0 0.4]) hold on area(x(x>=1.25),Y(x>=1.25),0,'EdgeColor'...

4 years ago | 0

| accepted

Answered
How do I modify my code to get rid of this error: "Index exceeds the number of array elements. Index must not exceed 1. Error in AEM614HW2Q2 (line 35) "
C(j,n) = 2*b/(pi*c(j)) * sin(n*theta) + n * sin(n*theta)/sin(theta);%get rid of theta(j) theta is scalar, cannot index >1 into i...

4 years ago | 0

| accepted

Answered
Normal Distribution and area under the curve
mu=67; sigma=4; x=72; y =1 - cdf('Normal',x,mu,sigma)

4 years ago | 0

| accepted

Answered
Integral not being computed
use vpaintegral syms t assume(t, "real") f1 = 3*t-t*t*t; f2 = 3*t*t; f = [f1, f2]; df = diff(f, t); a = 0; b = 1; normD...

4 years ago | 0

Answered
How can I get the mean value of 1st 10 values of a cell array
for k=1:prod(size(yourCell)) m(k)=mean(yourCell{k}(1:10)); end You can reshape m to 36x9 if desired.

4 years ago | 0

Answered
How do I check if the current value in an array is equal to 0 when looping? MatLab
Perform all calculations at once, then determine how you want to handle the 0's. xVelocity = zetaU./height; yVelocity = zetaV....

4 years ago | 0

Solved


Numeric array to cell array of strings (easy)
Given a numeric array (A) and a 1xk cell array of strings (C), return a cell array (B) that is the same size as A and in which e...

4 years ago

Solved


Check Number Even/Odd
Return 0 if number even, return 1 if number is false

4 years ago

Answered
Integral "int" function not evaluating
theta_s = 0:0.5:pi/2; syms theta_v phi=pi/6;%choose a phi or loop for various values of phi for i = 1:length(theta_s) in...

4 years ago | 0

| accepted

Answered
Finding erf using Maclaurin series breaks down around x = 5
ERF=@(x)round(2/sqrt(pi)*integral(@(t)exp(-t.^2),0,x),8);%much easier using the integral definition

4 years ago | 0

Answered
code a series using matlab that involve Pochhamer sumbol
If lam and u are not going to change, you could compute the series for the largest n as follows: for m=1:18 p(m)=prod(lam-(1...

4 years ago | 0

| accepted

Answered
Finding out the size of x (so how many xi we have) in a function handle
g=@(x)f1(x); g([1 2 3]) g([1 5]) function y=f1(x) if length(x)==2 y=x(1)^2+x(2)^2; elseif length(x)==3 ...

4 years ago | 0

Load more