Solved


Easy Sequences 109: Summation of Derivatives of a Trigonometric Function
A trigonometric function, , is defined as follows: where: ; and ...

3 years ago

Solved


Determine the minimum number of swaps to sort a vector
Cody Problem 1401 asks us to sort a vector with the bubble sort algorithm and count the number of swaps needed. For example, to ...

3 years ago

Answered
Attempting to take the z transform of a continuous transform function
tau = 1; sys = tf(5,[1 5],'InputDelay',tau) Alternate way s = tf('s'); G = exp(-tau*s)/(s+5)

3 years ago | 0

Question


MATLAB Answers Down?
I am unable to load new questions or recent questions (answered or unanswered). My feed is filled with activity from questions f...

3 years ago | 1 answer | 0

1

answer

Answered
Why is the legend in my MATLAB code showing only one color for all the items, even though the colors are different in the parallel coordinates graph?
Because there is only one line in the plot, as the plot is getting overwritten in each iteration. You need to use the command ...

3 years ago | 0

Answered
How to not prevent the msgbox and inputdlg from popping out at a same time?
You can merge the text and input the string in inputdlg() str = sprintf(['Please state your condition before taking the glucose...

3 years ago | 0

| accepted

Answered
Go back to user prompt in a switch case if no case is valid (Looping the switch statement)
"however the program seems to be in infinite loop" Because you have not added any break if any of the condition is satisfied. ...

3 years ago | 0

Solved


Flag a convertible string
If a string is able to be entirely converted to an integer, return a "true" flag. Otherwise, return a false flag. For example: ...

3 years ago

Solved


007: Chinese Barrack Invasion
*MISSION:* Successfully invade a military barrack located in China. *WARNING:* There is a row of _n_ security switches protec...

3 years ago

Answered
How to plot a function over an interval of two functions?
Convert the solution obtained by solve() to double. syms v Ncrn1= 2.5429/v^2 + 0.3251*v^2; fplot(v,Ncrn1,[0,9],'--') Ncrn2=5...

3 years ago | 0

| accepted

Answered
make loop if three variable (phi ,G and n) present calculate value for (G and n) and store separate name for same formula ?
"Can we store each row separately with different name like B1 for (n1,G1) , B2 for (n1,G2) and so on?" Any particular reason w...

3 years ago | 0

| accepted

Answered
How to create the "for" loop?
Loop approach datainput=rand(34,36); XSS=rand(34,1296); %Preallocation v=zeros(34,36,1296); for k=1:size(datainput,2) ...

3 years ago | 0

Answered
Matlab Code: Eval and Sub2ind
sub2ind() converts subscripts to linear indices. Say for example, you have a mxn matrix, and you want to find the linear index ...

3 years ago | 0

| accepted

Solved


Solve an ODE: separable equation
Solve the following ordinary differential equation: with the initial condition .The test suite will ask for the value of the ...

3 years ago

Answered
Removing characters from a datetime format to make it recognizable to MATLAB
The column with date time values is stored as a categorical array. Convert it to a string array and then use replace (you can al...

3 years ago | 0

| accepted

Answered
Problem on solving with dsolve
You got the wrong result because your equation is wrong, you forgot to include '*y' in the 3rd approach. eq=strcat('1/36','*D2y...

3 years ago | 1

Solved


MatCAT - Reconstruct X from Its X-rays
Consider a matrix x x = [ 1 2 0 0 5 0 3 0 8 ] If we sum x along the rows we get row_sums = [3 5 11] ...

3 years ago

Answered
Can i add Letters above bars
x=[1 2]; y=[1 3 5; 6 4 2]; b=bar(x,y); ylim([0 8]) str={'A','B','C'}; for k=1:numel(str) xt1=b(k).XEndPoints; yt1...

3 years ago | 0

| accepted

Solved


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 ...

3 years ago

Answered
False Position method. How many itinerations should it take to find the root?
A correction is needed - while n<maxits && error(n+1)>eps_x && abs(f(x0))>eps_f %^here If ...

3 years ago | 0

Answered
Arrays and different dimensions while saving outputs
"is there any way to store the outputs when they are of different size (e.g., the first loop gives an output of 10*1, and the se...

3 years ago | 1

| accepted

Answered
How can I write a matlab code for this iterative function.
tolerance=0.000001; %As it is not known at which iteration the sequence will converge, I have %assumed 1000 iterations for pre...

3 years ago | 0

| accepted

Solved


Easy Sequences 105: One-line Code Challenge - IPv4 Address Validation
The Internet Protocol version 4 (IPv4) is the dominant protocol for routing devices over the internet. IPv4 addresses are usuall...

3 years ago

Answered
My code is not running and i do not know what the problem is.
There is a typo while defining the variable alpha1. syms alhpa1 Correct it and you should be good to go. (I assume you have t...

3 years ago | 0

| accepted

Answered
how to plot from 0 to an output of a function using fplot
Convert the solution obtained by solve() to double. syms z L EI kd N n c d x Ld=10; Ncr1=(2.4674*EI*(2*n - 1)^2)/L^2; Ncr2=-...

3 years ago | 0

| accepted

Answered
Remove rows from matrix based on condition
%Let "in" be your matrix %Finding the rows that meet this condition idx = in(:,2) > 0.08 | in(:,2) < -0.08; %Deletion in...

3 years ago | 0

| accepted

Solved


Harmonic series counting
The function takes a positive limit as input, And counts how many terms must be summed in the harmonic series: 1/1, 1/2, 1/3, ...

3 years ago

Problem


Sequence Vectorization - II
This is the second part to the question - Sequence Vectorization - I Given an array of Natural numbers, N, return the sequence ...

3 years ago | 2 | 9 solvers

Solved


Sequence Vectorization - I
Given a Natural number N, return the sequence - [1 1 2 1 2 3 1 2 3 4 ... 1 2 3 ... N-3 N-2 N-1 N] i.e. the concatenation of (1:k...

3 years ago

Load more