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

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 1

| akzeptiert

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

mehr als 2 Jahre vor | 1

| akzeptiert

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

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
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)

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
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)']

mehr als 2 Jahre vor | 1

| akzeptiert

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 3

| akzeptiert

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 1

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

mehr als 2 Jahre vor | 0

Beantwortet
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)

mehr als 2 Jahre vor | 0

| akzeptiert

Gelöst


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

mehr als 2 Jahre vor

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 2

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

mehr als 2 Jahre vor | 0

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

mehr als 2 Jahre vor | 2

| akzeptiert

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

mehr als 2 Jahre vor | 1

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

mehr als 2 Jahre vor | 1

| akzeptiert

Mehr laden