Solved

Longest run of consecutive numbers

Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

6 hours ago

Answered

How to choose data with three conditions to plot contour

x(x<0 & x>-25) = 0;

How to choose data with three conditions to plot contour

x(x<0 & x>-25) = 0;

5 days ago | 1

| accepted

Answered

plot the month and year in X-axis

clear;clc;close all tab = xlsread('data_final'); Date = datetime(tab(:,1),tab(:,2),1); data = tab(:,3); [Date,I] = unique(...

plot the month and year in X-axis

clear;clc;close all tab = xlsread('data_final'); Date = datetime(tab(:,1),tab(:,2),1); data = tab(:,3); [Date,I] = unique(...

5 days ago | 0

| accepted

Answered

peak finding of a graph

x=V1_1_new; y=y1_1_new; [pks, locs] = findpeaks(y); plot(x,y,x(locs),pks,'o')

peak finding of a graph

x=V1_1_new; y=y1_1_new; [pks, locs] = findpeaks(y); plot(x,y,x(locs),pks,'o')

10 days ago | 0

Answered

Taking values from a Matrix and Inputting into an equation, using Loops

A = [1 2 3 4 5 6 7]; for i = 1:length(A) x = A(i); y(i) = x^2; end y

Taking values from a Matrix and Inputting into an equation, using Loops

A = [1 2 3 4 5 6 7]; for i = 1:length(A) x = A(i); y(i) = x^2; end y

13 days ago | 0

| accepted

Answered

how add Month label in x axis

clear; close all; clc month = {'apr19', 'may19', 'june19', 'july19', 'aug19', 'sept19', 'oct19', 'nov19', 'dec19', 'jan20', 'fe...

how add Month label in x axis

clear; close all; clc month = {'apr19', 'may19', 'june19', 'july19', 'aug19', 'sept19', 'oct19', 'nov19', 'dec19', 'jan20', 'fe...

14 days ago | 0

| accepted

Answered

How to find the limit of a transfer function defined using tf?

sys1=tf([20 20],poly([-4 -3])); [Num,Den] = tfdata(sys1,'v'); syms s sys_syms=poly2sym(Num,s)/poly2sym(Den,s); lim = limit(s...

How to find the limit of a transfer function defined using tf?

sys1=tf([20 20],poly([-4 -3])); [Num,Den] = tfdata(sys1,'v'); syms s sys_syms=poly2sym(Num,s)/poly2sym(Den,s); lim = limit(s...

14 days ago | 0

| accepted

Answered

How to make a gif or video file from multiple *.dat* files using Matlab?

use getframe and writeVideo in for-loop

How to make a gif or video file from multiple *.dat* files using Matlab?

use getframe and writeVideo in for-loop

14 days ago | 0

Answered

Taking too long to get the output (Wilson theta method)

Without loops it runs faster. Please check it carefully clc;close all;clear; MA = [8070000,0,-629468070;0,8070000,112980;-6294...

Taking too long to get the output (Wilson theta method)

Without loops it runs faster. Please check it carefully clc;close all;clear; MA = [8070000,0,-629468070;0,8070000,112980;-6294...

14 days ago | 0

| accepted

Answered

How to plot multiple fitted curves in single plot with different colors and legends

You can predefine your colors for example as colors = {'r','g','b'}; % or colors = colormap(jet(3)); % etc. and than in lo...

How to plot multiple fitted curves in single plot with different colors and legends

You can predefine your colors for example as colors = {'r','g','b'}; % or colors = colormap(jet(3)); % etc. and than in lo...

16 days ago | 0

Answered

How can I insert two quadratic trendlines for two datatsets (one each) on the same figure?

clc; close all; clear; x = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]; % x plot y1 = [1660.383 1665.397 1671.268 1678.238 1...

How can I insert two quadratic trendlines for two datatsets (one each) on the same figure?

clc; close all; clear; x = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]; % x plot y1 = [1660.383 1665.397 1671.268 1678.238 1...

16 days ago | 0

| accepted

Solved

Draw 'O' !

Given n as input, generate a n-by-n matrix 'O' using 0 and 1 . example: n=4 ans= [1 1 1 1 1 0 0 1 ...

1 month ago

Solved

Get the area of the square.

Four circles are inscribed in the square ABCD. The perimeter of each circle is *aπ*. <<http://imgfz.com/i/UzgCJut.png>> Gi...

3 months ago

Solved

Rescale Scores

Each column (except last) of matrix |X| contains students' scores in a course assignment or a test. The last column has a weight...

3 months ago

Solved

Calculate Inner Product

Given two input matrices, |x| and |y|, check if their inner dimensions match. * If they match, create an output variable |z|...

3 months ago

Solved

Find MPG of Lightest Cars

The file |cars.mat| contains a table named |cars| with variables |Model|, |MPG|, |Horsepower|, |Weight|, and |Acceleration| for ...

3 months ago

Solved

Find the Best Hotels

Given three input variables: * |hotels| - a list of hotel names * |ratings| - their ratings in a city * |cutoff| - the rat...

3 months ago

Solved

Crop an Image

A grayscale image is represented as a matrix in MATLAB. Each matrix element represents a pixel in the image. An element value re...

3 months ago

Solved

Calculate BMI

Given a matrix |hw| (height and weight) with two columns, calculate BMI using these formulas: * 1 kilogram = 2.2 pounds * 1 ...

3 months ago

Solved

Plot Damped Sinusoid

Given two vectors |t| and |y|, make a plot containing a blue ( |b| ) dashed ( |--| ) line of |y| versus |t|. Mark the minimum...

3 months ago

Solved

Calculate a Damped Sinusoid

The equation of a damped sinusoid can be written as |y = A.ⅇ^(-λt)*cos(2πft)| where |A|, |λ|, and |f| ...

3 months ago

Solved

Solve a System of Linear Equations

*Example*: If a system of linear equations in _x₁_ and _x₂_ is: 2 _x₁_ + _x₂_ = 2 _x₁...

3 months ago

Solved

Verify Law of Large Numbers

If a large number of fair N-sided dice are rolled, the average of the simulated rolls is likely to be close to the mean of 1,2,....

3 months ago

Solved

Find the Oldest Person in a Room

Given two input vectors: * |name| - user last names * |age| - corresponding age of the person Return the name of the ol...

3 months ago

Solved

Convert from Fahrenheit to Celsius

Given an input vector |F| containing temperature values in Fahrenheit, return an output vector |C| that contains the values in C...

3 months ago

Solved

Calculate Amount of Cake Frosting

Given two input variables |r| and |h|, which stand for the radius and height of a cake, calculate the surface area of the cake y...

3 months ago

Solved

Newton's Motion Law

F is force, m is mass, and a is acceleration. Calculate the force for an object.

3 months ago

Solved

Circular Primes (based on Project Euler, problem 35)

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. The...

3 months ago

Solved

Mersenne Primes vs. All Primes

A Mersenne prime (M) is a prime number of the form M = 2^p - 1, where p is another prime number. <https://www.mathworks.com/matl...

3 months ago

Solved

Find the next prime number

Find the next prime number or numbers for given n. For example: n = 1; out = 2; or n = [5 7]; out = [7 11]; ...

3 months ago