Solved


Use a timetable to analyze a train timetable (Part 3)
Oh no, you missed your train to Boston (again?)! How many times can you miss that train today? (In other words, how many Boston ...

4 years ago

Solved


Data Regularization
Provided is an m-by-n integer data matrix A whose elements are drawn arbitrarily from a set *S* = [1,2,3,...,S] for any large in...

4 years ago

Answered
Division by repeated subtraction with remainder
Your while loop is stuck in an infinite loop since it defines r as the same value every time. I have modified it DbyS(17,4) Db...

4 years ago | 1

Answered
Change for loop to while loop.
%n = input ("Input an integer: "); n=11; fprintf('Odd numbers: ') x=1;o=1; while x<=n fprintf(' %d',x) o=o*x; ...

4 years ago | 1

Solved


Create a random vector of integers with given sum
Your task today is to write a function that returns a vector of integer numbers, between, and including, 1 and m, of which the s...

4 years ago

Solved


String Manipulator
Write a script that takes a string as an input and returns a cell array containing – I. the count of vowels. II. Find the ind...

4 years ago

Answered
Can vpasolve restrict the numerical solution to be a real number? If it can, how should I stipulate this condition?
Taken from vpasolve documentation syms x S = vpasolve(x^6 - x^2 == 3, x) assume(x,'real') S = vpasolve(x^6 - x^2 == 3, [-I...

4 years ago | 2

Solved


Tic-Tac-Logic - Solution Checker
<http://www.conceptispuzzles.com/index.aspx?uri=puzzle/tic-tac-logic/rules Tic-Tac-Logic> is a logic puzzle wherein a rectangula...

4 years ago

Answered
Problems with a if statement in a for-loop
So, Anzahl_runs is 260 meaning the for loop will run from 1 to 260. Suppose your condition did not find a 1 in any row, so it w...

4 years ago | 1

Solved


Portfolio diversification: choose your stocks !
we have the returns of 3 stocks for the last 4 years and we have to combine only 2 stocks that are less correlated. Example: st...

4 years ago

Answered
How do I make an average voting algorithm for a multiclass problem with 3 classes?
a=[1 2 3 4 5.4 6]; b=[4 5.6 6.8 7 8 9]; c=[7 8 9 10 11 12.5]; af=floor(a); bf=floor(b); cf=floor(c); %getting similar ...

4 years ago | 1

Answered
Get n numbers from a list
Binary approach (however, it might get slow for large numbers of element in x) %vectorized method of this approach might be a l...

4 years ago | 1

| accepted

Answered
how to check if an entry in a timetable is either smaller or larger, to entries in another timetable with identical dates?
Convert them to numerical value using datenum and check y=table(datetime(2022,4,17:30)) y.Var1 datenum(y.Var1)>=datenum(2022,...

4 years ago | 1

Answered
I have 2 columns in a matrix. 1st column has the dates. 2nd column has the values. How do I grab all values from 2nd column associated with its date from the 1st column??
%example, not sure which date format and data type you are using y={datetime('2018-01-04') 6;datetime('2018-02-04') 22;dateti...

4 years ago | 2

Answered
I need a little help with this 3d plot contour.
x=-4:0.1:4; y=-4:0.1:4; [X, Y] = meshgrid(x,y); Z = 2*(peaks(X, Y)-3); fig2=figure(2); map=[0 0 1; 1 1 1; 1 1 1; 1 1 1; 1 1...

4 years ago | 1

| accepted

Solved


Count of Unique Elements of a Vector
Count the number of times each unique element appears in a vector. Example: Input x = [2 9 1 2 4 9 2] Output y = [1 1; 2 3; 4...

4 years ago

Answered
Trouble plotting a 3D meshgrid
[x,y]=meshgrid(-4:0.1:4,-3:0.1:3); %Making the difference smaller to get a smoother mesh z=sqrt((x.^2/4)+2*sin(0.7*y).^2); mes...

4 years ago | 1

| accepted

Solved


n-th digit of write-down all numbers
Write down number as 123456789101112131415161718192021222324252627282930... what's the n-th digit? input n and get the digit.

4 years ago

Answered
I want to generate the random numbers in the closed area (rectangle).
If you mean in the range (0,4) and (0,25) - %N = number of points you want, you can also run a for loop (upto you how you want...

4 years ago | 1

| accepted

Answered
Generates 1xN vector (row), symbol values A0 and A1
A0=1; A1=-A0; %N=input ('Enter a number \ n'); %check if N is an even number by using ifelse N=8; %using a random value for e...

4 years ago | 1

| accepted

Solved


Put two time series onto the same time basis
Use interpolation to align two time series onto the same time vector. This is a problem that comes up in <http://www.mathwork...

4 years ago

Answered
ind() function or find() function not working
Use ind = find(A==b); %find(x) is generally used for matrices to find non-zero values.

4 years ago | 1

| accepted

Answered
How to make a three dimensional matrix
%random example y = reshape(1:30,5,6); repmat(y,1,1,3)

4 years ago | 2

| accepted

Answered
How do I plot a multivariate piecewise continuous function?
k=meshgrid(-1:0.01:1); for i=1:size(k,1) for j=1:size(k,2) if k(i).. & k(j).. f(i,j)=..; el...

4 years ago | 1

Solved


Find mistyped words in text (mixed-up letters)
Mistyped words are a regular occurrence in emails, texts, status updates, and the like. Many times, people send or post a second...

4 years ago

Solved


Wrap a vector, but insert NaN's at the wrap-positions.
When you plot a line that wraps, and do not want the sawtooth shape to show up in the plot, you can either draw all separate lin...

4 years ago

Solved


Removing rows from a matrix is easy - but what about inserting rows?
Assume A is a 5-by-5 matrix. A([2,4],:) = [] is a quick way to remove rows 2 and 4. Can you find a quick way to insert rows into...

4 years ago

Solved


Assignment Problem
Given a matrix where row i corresponds to person i, and column j corresponds to task j and cell (i,j) corresponds to the time ta...

4 years ago

Solved


A Poker Hand
Texas Hold ‘Em is a classical card game. In this problem, we are concerned with determining the probability of attaining a certa...

4 years ago

Load more