Solved


Is the number of 1s in a binary integer odd or even?
Your function should turn the input integers into binary form and count the number of 1s in the binary. If the number is odd, re...

4 years ago

Answered
Why does my else doesnt work?
a = [-3.821; 0.135; 5.995; -5.557; -4.041; -3.094; -3.244; -3.074; -1.241; -4.216; -2.834; -0.424; 5.337; -0.088; 2.985; 4.136;...

4 years ago | 1

| accepted

Solved


Cricket - Report the Result (Part I: Limited Overs)
Given two scalar strings representing the scores for a limited-overs match, return a string reporting the result in the form "Te...

4 years ago

Solved


Cricket - Peak Batting Average
Given a vector s of strings representing a batter's individual innings scores (in chronological order), return the highest batti...

4 years ago

Solved


Cricket - Represent Average in "Dulkars" and "Ses"
Sachin Tendulkar's Test average was 53.78. So if Tendulkar = 53.78, one dulkar = 5.378. Similarly, Roger Twose's average was 25....

4 years ago

Solved


Cricket - Career Bowling Statistics
Given a vector s of strings representing a bowler's individual innings records, return their career statistics as a 3-element (n...

4 years ago

Answered
'MarkerFaceColor' according to y value
x = linspace(0,3*pi,200); y = cos(x) + rand(1,200); sz = 25; c = y/max(y)*10; scatter(x,y,sz,c,'filled') hold on; plot(x,y...

4 years ago | 0

Solved


List the nth term of Rozhenko’s inventory sequence
Consider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few i...

4 years ago

Solved


List numbers that are not in the Fibonacci sequence
In the list of 4797 Cody problems, 53 deal with or refer to the Fibonacci sequence.* What about the other numbers? Write a funct...

4 years ago

Answered
Difference between x = 0:0.1:2*pi and linspace(0,2*pi,0.1)
Linspace divides the interval into the exact number specified, while colon notation just keeps increasing the interval by the mi...

4 years ago | 1

| accepted

Solved


Slope intercept application
Find y given slope (m), x, and y intercept (b).

4 years ago

Solved


Easy Sequences 81: Fibonacci Radicals
The radical of a positive integer is defined as the product of the distinct prime numbers dividing . For example, the distinct ...

4 years ago

Solved


Check if a year is a leap year or not
Return 1 if a given year is a leap year or 0 if it is not

4 years ago

Solved


Remove Duplicates
Remove duplicates from the vector of integers and display in sorted order

4 years ago

Answered
zeros populating most of my output vector
You will start running into problems with higher no_of_calls because the no_of_channels will increase and factorial numbers will...

4 years ago | 1

| accepted

Solved


Compute the drag on a moving vehicle
We assume no rolling resistance, and the simple rule for Drag : , where is the density of the fluid (assumed at 1.2 ), is the ...

4 years ago

Solved


Determine if vector has any zeroes
Return 1 if vector has atleast 1 zero, else return 0

4 years ago

Answered
Generate random numbers with truncated Pareto distribution
Just write a simple function function x = ranPareto_trunc(H,L,alpha,n)%H=upper, L=lower, alpha>0, n=number of random numbers de...

4 years ago | 0

Solved


Cricket - Career Batting Statistics
Given a vector s of strings representing a batter's individual innings scores, return their career statistics as a 4-element (nu...

4 years ago

Answered
is it possible to make this code shorter?
r=x/2.*cos(cumsum(rad)); R=[r(1),2*cumsum(r(1:6))+r(2:7)]; mg=flip(cumsum(flip(Fz.*R))); c=-mg./rad;

4 years ago | 0

Solved


Cricket - How Much More to Beat Bradman?
Sir Don Bradman famously needed only 4 runs in his final innings to retire with an average of 100. Out for a duck, he ended inst...

4 years ago

Solved


Cricket - Average Partnership Contribution
The (infamous) Duckworth-Lewis method uses statistical models of how much each wicket partnership is worth to an innings (on ave...

4 years ago

Solved


Cricket - Sort Batters by Distance Run
Given a string vector of batters' names, a vector of the total number of runs they scored, a vector of the number of 4s they sco...

4 years ago

Solved


Easy Sequences 80: Sum of the n-th Row of Fibonacci Square Triangle
We shall call the following arrangement of Fibonacci numbers, as the Fibonacci Square Triangle: where...

4 years ago

Answered
Randomize a marker color for a graph
m='o+*.x'; c='rgbcmyk'; x=randi(20,1,8); y=randi(20,1,8); figure;hold on; for n=1:length(x) scatter(x(n),y(n),'LineWidth...

4 years ago | 0

Answered
why is this code not working?
Function works fine. f=@(x)x.^2.*sin(x)-x.*cos(x)+3;%sample function df=@(x)x.^2.*cos(x)+3*x.*sin(x)-cos(x); [root,iter,v]=ne...

4 years ago | 1

| accepted

Answered
How to create a polar plot?
load S x = real(S); y = imag(S); rho = sqrt(x.^2+y.^2); theta = atan2(y,x);%use atan2 (4 quadrant) polarscatter(theta, rho,...

4 years ago | 0

| accepted

Answered
custom distance with the kmeans
data=randi(100,10,2); centroid1=randi(100,1,2); centroid2=randi(100,1,2); m=sum(abs((data-centroid1)./std(data(:,1))),2); n=...

4 years ago | 0

Answered
How to keep false as false, and not as zero
If you are just using false as a flag, change false into some other number flag. You could use a particular number that will nev...

4 years ago | 1

| accepted

Solved


Cluster Partition
Given an array (row or column) of numbers, divide the array into consecutive positive/negative numbers. 0 is to be treated inde...

4 years ago

Load more