Answered
Matlab double sum over vectors
Using 4 nested for loops will be take quite a good amount of time to run, specially if N is a comparetively big value. You can ...

3 years ago | 0

Answered
Choosing Elements from a Vector.
Use find - A = [0 1 2 3 4 5 6 7 8 9] %This finds all the elements in A that are equal to 5 idx = find(A==5) %In case 5 appe...

3 years ago | 0

| accepted

Answered
How to write cell array to excel file?
The data you have is stored in a weird manner. load('cell matrix.mat') whos 169560 bytes for a 9x5 cell, Hmmm. final_best_...

3 years ago | 0

| accepted

Answered
help for an exercise answer
A simple way is to define 2 vectors (choose values as per your liking) of the given size and find out which are allowed and whic...

3 years ago | 0

Answered
Complex Roots of a quadratic function
"Right now, I am not getting anything to display after doing the inputs." It is because you have not called the function. To ge...

3 years ago | 0

Answered
Matrix Data Results Explanation
nansum does not do what you are expecting it to do. Also, using nansum() is not recommended as you can see from its documentatio...

3 years ago | 0

| accepted

Answered
I'm asked to create new variable called H that has same 1st column as G but I need to replace the element in the 2nd column 1st row of G with 2nd column 2nd row of Mat1
You have done the reverse of what you are asked to do - % Basic Matrix Manipulations % part a) define Mat1 below Mat1 = [1...

3 years ago | 0

Answered
How to evaluate a matrix of commands
"Each command in the array when run, will produce a single number." Use str2num Or for quite large values, use str2sym, if you...

3 years ago | 0

| accepted

Answered
I'm trying to use a while loop to delete the final row in an array every time it loops, however, it's not working
Firstly, use readmatrix or readtable instead of importdata. Secondly, you can define variables from function calls, instead of ...

3 years ago | 1

| accepted

Answered
I have a variance question, however, my code isn't bringing up this in the command window when i try to run it. "Function definition are not supported in this context".
This section should not be a part of the function definition. Use this section to call the function from the command window/line...

3 years ago | 1

| accepted

Answered
Adding Text To Table Data
FileName = 'ct4004355_si_003.txt'; T = readtable('ct4004355_si_003.txt', 'Delimiter','\t', 'TextType','string'); Rows = T(130:...

3 years ago | 0

| accepted

Answered
subtracting arrays from each other
a = [16 24 30 27 30 35]; b = [6 14 20 17 20 25]; c = a(1:end-1) - b(2:end)

3 years ago | 0

Answered
How to plot frequency spectrum in log-log scale?
If you change the scale of axes and plot the data afterwards, the scale will get modified according to the data. Better to chang...

3 years ago | 0

| accepted

Answered
Horzcat error, attempting to display a matrix 3x11
R=[148;36;49;-45;166] % 5x1 double Rvx= [1 zeros(1,2*numel(R)); 0 cos(R)' sin(R)'; 0 -sin(R)' cos(R)']

3 years ago | 1

| accepted

Answered
multiplication of combinaton values?
You are looking for a - nchoosek b1 - prod and b2 - sum

3 years ago | 0

| accepted

Answered
Problem 2022. Find a Pythagorean triple
While your solution works theoretically (and symbolically), numerically there's a good chance it will fail. And there's a guar...

3 years ago | 3

| accepted

Answered
Why do I receive parse error at line 30
You get the error because, you have used incorrect syntax for squaring trignometric terms for defining delta_u. The correct syn...

3 years ago | 0

| accepted

Answered
Polar Plot of radiation efficiency
It seems that plotting multiple plots with polarpattern retaining existing plots changes the line-style of the plots to the late...

3 years ago | 0

| accepted

Answered
Can I change the color of the label in xline / yline to be different from the color of the line?
Unfortunately, No, there is no property "Label color" for xline and yline functions (Constant Line Annotation) which can be modi...

3 years ago | 0

Answered
Why do I receive and error message for the negative in my function?
The syntax for defining anonymous functions is - f = @(list_of_independent_variables) relation_of_indepent_variables; So for...

3 years ago | 0

Answered
what is the best mode to populate this array in this loop annidate?
It would be better to use string instead of cells as they take less memory and easier to work with - n=5; b=2; valA=rand(n,...

3 years ago | 1

Answered
Same color for different subplots
"Then I need to define an array of 10 different colors:" Yes. RGB colors are a 3 element vectors with values in the range [0, ...

3 years ago | 0

Answered
How can I get the indxes from a logical vector?
find is what you are looking for. input = [1,1,1,0,0,1,0,1]; output = find(input)

3 years ago | 0

| accepted

Solved


Compute the maximal product of any two numbers whose concatenation is n
Write a function that takes an input and computes the maximal product of numbers that concatenate to . For example, if , then t...

3 years ago

Answered
what code to plot dark stairs colors
Darker colors correspond to the lower range of [0,1] of the RGB scale. r=5; str = compose('x^%d',1:r); hold on for k=1...

3 years ago | 0

| accepted

Answered
Solve Linear Equation with Constraints on Variables
syms L1 L2 L3 m1 m2 m3 n1 n2 n3 A = [-1, 1, 1; 1,-4,2; 1, 2,-4]; B1 = [L1; m1; n1]; C = [0;0;0]; %Equations to be solved ...

3 years ago | 2

Answered
Can someone please explain why my function wont plot correctly
You need atleast 2 sets of values to plot a graph. I assume you want to plot fig1 against t t=0:10; fig1=0.001*sin((2*t)+(pi/...

3 years ago | 0

Answered
Problem 44952. Find MPG of Lightest Cars
Hello Mayla, The reason your code does not pass the test suite is because the variable mpg in your code is of Table data type, ...

3 years ago | 2

| accepted

Answered
Repeat array onto the same row
Here's a generalised code - A=[1,2,3,4]; B = repetition(A,2) B = repetition(A,1.5) B = repetition(A,2.75) B = repetition...

3 years ago | 1

Answered
LCM seems broken. What am I missing?
"What am I missing?" You are expecting it to work a particular way. You looked up an example from the documentation page of l...

3 years ago | 1

| accepted

Load more