A résolu


Identify de Polignac numbers
The numbers 125 and 329 can be written as the sum of a prime and a power of 2. For example, , and . The numbers 127 and 331, whi...

environ 3 ans il y a

A résolu


Given a string s, find the length of the longest substring without repeating characters.
Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = "abcabcbb" O...

environ 3 ans il y a

A résolu


Find a number m such that 2m and the square of m have the same digit sum
The number has the property that and have the same digit sum. It is the seventh number, including zero, in the sequence of nu...

environ 3 ans il y a

A résolu


Find The area of the square
Given that the length of the side of a square is x, find the area.

environ 3 ans il y a

A résolu


Easy Sequences 104: One-line Code Challenge - GCDs of Sum of Consecutive Cubes
For a natural number, n, the function CC(n) is defined as follows: In other words, CC(n) is the sum of cubes ...

environ 3 ans il y a

A résolu


raise x to the nth power
use basic math operators and a variable to solve the problem for a given variable n. (make sure "n" is the variable you use)

plus de 3 ans il y a

A résolu


multiply by 5
multiply x by 5

plus de 3 ans il y a

A résolu


multiply by 12
multiply x by 12

plus de 3 ans il y a

A résolu


Calculate BMI
Given weight in kgs and height in metres, calculate body mass index

plus de 3 ans il y a

A résolu


Easy Sequences 100: One-line Code Challenge - 100th Digit of 100th power of an Integer
Given a integer , write a function that computes the digit of . If has less than digits just output a NaN. For example if , ...

plus de 3 ans il y a

Réponse apportée
How to round numbers using the decimals as a probability?
A=10*rand(1,10) B=floor(A)+((A-floor(A))>rand(1,10))

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Is there a function like movsum which simply gets the values in a given sliding window rather than summing them?
b=1:10; a=b; n=5;%window size for k=1:n-1 a=[a;circshift(b,-k)]; end a=a'; a=a(1:length(b)-n+1,:)

plus de 3 ans il y a | 0

Réponse apportée
Create Number and excluding
No need for loops. A=randi([5,15],1,100); A(A==9|A==13)=[]; A

plus de 3 ans il y a | 0

Réponse apportée
Analysing PWM duty cycle of a signal
s=pwm>threshold;%pwm is your signal, threshold is when it is considered on or off d=diff(s); idx1=find(s,1); idx2=find(d==-1)...

plus de 3 ans il y a | 0

Réponse apportée
Storing Data and working out an equation
Just index, no loop needed. Filtered_Gear_rpm=rand(40000,1);%sample data Filtered_NES_rpm=rand(40000,1);%sample data x=Filter...

plus de 3 ans il y a | 0

Réponse apportée
solve non-linear equation
Use fzero eqn=@(z)exp(-z)+pho*exp(L-2*z)-G;%you could plot the function to find the approximate location of the root z=fzero(e...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Index in position 2 exceeds array bounds
for i = 1:numel(uniq) Tyro1{i} = table2cell(REQtyr(ismember(resSeq,uniq(i)),["AtomName","X","Y","Z"])); Tyro{i} = tabl...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Error in for loop (issue with variable calling)
for i = 1:1 z1 = importdata("Xxsv0000"+num2str(i)+".txt"); Time{i} = z1.data(:,1); ...

plus de 3 ans il y a | 1

Réponse apportée
Find column number for every row in matrix
a=[ -1 4 1 1 -1 -1 -5 4 -1]; A=(a>0)'; [b,d]=find(A); [~,e]=unique(d); b(e)

plus de 3 ans il y a | 0

Réponse apportée
How do I crop a matrix within desired numerical limits?
M=[-2+16*rand(100,1),-17+9*rand(100,1),-3+5*rand(100,1)]; M(M(:,3)<-2|M(:,3)>1,:)=[]; M(M(:,2)<-16|M(:,2)>-9,:)=[]; M(M(:,1)<...

plus de 3 ans il y a | 0

Réponse apportée
How to select vectors from a set of vectors
x=[1 1 1 1 0 0 0 0;1 0 0 0 1 1 1 0;0 1 0 0 1 0 0 1;0 0 1 0 0 1 0 1;0 0 0 1 0 0 1 0]; r=randi(8,1,500); y=x(:,r)

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
I need to combine those three martix into a single big one. How do I do that?
blkdiag(randi(10,2),randi(10,2),randi(10,2))

plus de 3 ans il y a | 0

Réponse apportée
Compare vector to two other vectors
m=randi(100,1,20); n=randi(100,1,30); k=randi(100,1,10000); [M,N]=meshgrid(m,n); x=min(M,N); z=zeros(size(x)); u=unique(x)...

plus de 3 ans il y a | 0

Réponse apportée
Function might not be used error
[e,t,a]=CalcTip(100,3) [e,t,a]=CalcTip(100,4) [e,t,a]=CalcTip(100,5) [e,t,a]=CalcTip(100,2) function[error, tip, amoun...

plus de 3 ans il y a | 0

Réponse apportée
Having trouble converting rpm to 1/s using unitConvert from symunit
You want rps u = symunit; n = 2950 * u.rpm; w = vpa(unitConvert(n,u.rps))

plus de 3 ans il y a | 1

Réponse apportée
creating an array from a single user input
userinput = input('input nth value for fibonacci calculation:'); %define two empty matrices one for fibonacci values and one fo...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
low quality figure problem when saving as svg or pdf ( using fill function)
How is the quality different? My saved pdf looks just the same. x=rand(10,10); y=rand(10,10); z=rand(10,10); figure,axis equ...

plus de 3 ans il y a | 1

Réponse apportée
Mask with a for loop
removeData([2 3 0 0 7 8 0]) function [newVec] = removeData(vec) newVec = zeros(size(vec)); for x = 1:length(vec) %don't hav...

plus de 3 ans il y a | 0

Réponse apportée
Easiest way to check if the point is on the land or on sea?
Do you have the mapping toolbox? Use https://www.mathworks.com/matlabcentral/fileexchange/48661-landmask If so it is as simple a...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How can I load data from Excel file to Matlab in script and use the data loaded to calculate?
MSU1=readmatrix('Relaxation data.xlsx','Range','A4:E82')%load the others following the same method

plus de 3 ans il y a | 1

Charger plus