Gelöst

Property dispute!
Two neighbors have rectangular plots of land A and B. The surveyors give you the coordinates of each. If they overlap, there is ...

3 Monate vor

Gelöst

Sun angle
Determine the angle of the sun above the horizon based on the time of day. Assumptions: the sun rises in the East at 6h00, cor...

3 Monate vor

Gelöst

Compress list
Given a non-empty list L of positif integers, compress the list so that only one occurrence is retained if two (or more) equal e...

3 Monate vor

Gelöst

Beam me up, Scotty!
It's the mid 22nd century. You, Montgomery Scott, are appointed the chief engineer of the Starship Enterprise. The Starship is...

3 Monate vor

Gelöst

Calculate the Area of the Ring
You have Ring which consist of inner and outer Circles with Radius r and R which are not given but you'll be given Hprizontal ...

3 Monate vor

Gelöst

Find Next Strictly Greater Element
Given an array of numbers, create a new array where each element represents the next strictly greater element to the right of th...

3 Monate vor

Gelöst

Remove Unique Elements
Given a list of integers, we want to keep only the non-unique elements in this list. To do this, we need to remove all the uniqu...

3 Monate vor

Gelöst

Out-of-Place Elements Count
Determine the number of elements in a list of integers that are not in their original order after sorting the list in ascending ...

3 Monate vor

Gelöst

Largest Rectangle Area in a Histogram
Given a histogram represented by an array of integers, e.g., [2, 1, 4, 5, 1, 3, 3] : find the maximum area of a rectangle tha...

3 Monate vor

Gelöst

Maximizing Stock Profit
As a stock exchange broker focusing on a single transaction, your goal is to maximize profit by buying a stock at a low price an...

3 Monate vor

Gelöst

Spreadsheet uses an alphabetic naming system for columns, starting with 'A', 'B', 'C', etc. The column names continue like 'AB',...

3 Monate vor

Gelöst

Secret Message and Acrostic
One of the simplest ways to hide a message involves utilizing uppercase letters. Given a text, collect all uppercase letters in...

3 Monate vor

Gelöst

snake_case to CamelCase convention
The snake_case naming convention writes words in lowercase and separates them with underscores. In CamelCase convention, the fir...

3 Monate vor

Gelöst

CamelCase to snake_case convention
The CamelCase naming convention capitalizes the first letter of each word. In snake_case convention, words are written in lowerc...

3 Monate vor

Gelöst

Instructions Following
Complete the function follow(s) which, for a given string (containing only the letters 'f', 'b', 'l', 'r'), calculates the final...

3 Monate vor

Gelöst

Interval Compression
Given a set of integers, the task is to create a list of closed intervals where each interval includes its endpoints. For exampl...

3 Monate vor

Beantwortet
Why I am not getting the same result for an integral of a piecewise function?
1 - It should be aux1 - (aux2 + aux3) 2 - The function is not vectorized properly, which provides incorrect results. I have mod...

4 Monate vor | 0

| akzeptiert

Beantwortet
array generation using logics.
x = [0 10 20 30 0 10 20 30 40 0 10 20 30 40 50 0 10] y = x; idx = [1 find(diff(x)~=10)+1 numel(x)] for k=1:numel(idx)...

4 Monate vor | 0

Beantwortet
How programmatically create an array from variable-length vectors?
Here's a method to import data from a sequence of files - %Read all the mat files in the directory Files = dir('*.mat'); %...

4 Monate vor | 0

Beantwortet
How to substitute a variable into a syms function?
Define the variable as a symbolic variable and then substitute - syms Vpo Von Dp Dn ws Lp Cps Ll Lm Vsecm Isec_real Isec_imag ...

4 Monate vor | 0

| akzeptiert

Beantwortet
How do I change the format of symbolic output
Change the symbolic preference of Type-setting as follows - syms x y sol = solve(y-x^2,x) %Preference changed (Default v...

4 Monate vor | 0

| akzeptiert

Beantwortet
Turn sequence into a loop
A better approach would be to vectorize, see below. (I assume all the arrays to be used have compatible dimensions for operation...

4 Monate vor | 0

Beantwortet

Use find - %Sample data mat = magic(4); mat = [mat; 1 4 9 16] %Get the maximum value val = max(mat, [], 'all') %% Find th...

4 Monate vor | 1

| akzeptiert

Beantwortet
Read text file line by line to columns
Use readmatrix (available from R2019a onwards) to read the data and transform it as per need - in = readmatrix('RANCHOD - Copy...

4 Monate vor | 2

Beantwortet

Preallocate a cell array, define each cell element accordingly and use indexing to access the data - %Number of arrays n = 10...

5 Monate vor | 0

Beantwortet
Where can I find the documentation for polling methods applicable to paretosearch?
From the User's Guide of Global Optimization Toolbox, available here - https://in.mathworks.com/help/pdf_doc/gads/index.html (Pa...

5 Monate vor | 0

| akzeptiert

Beantwortet
Subs does not work in my code.
You can vectorize operations in the code - function [sMnew] = Cubic(k,M) n = 3*k+1; x = sym('x'); c = sym( 'c', [1 M+3]); ...

5 Monate vor | 0

Beantwortet
Randomly giving "ans" value but i dont want that
"How can i prevent the creation of the "ans" ?" When calling a function with multiple outputs without specifying the outputs, o...

5 Monate vor | 1

Beantwortet
How to plot points with corresponding colour
(Assuming there are only red and blue colors for the plot) Use logical indexing - %Check which elements of B are red idx = str...

5 Monate vor | 1

| akzeptiert

Beantwortet

I scrolled across the image - jie is already defined as a struct (possibly in the code before this particular lines), thus you c...

5 Monate vor | 0

| akzeptiert