Respondida
Trying to Display a found answer with units
function Vtotal = tankvolume(h) rc = 10; rf = 20; hc = 30; hf = 25; if h < 0 Vtotal = -1; disp('Error h Cannot be Negati...

más de 3 años hace | 0

| aceptada

Respondida
My program is not stop. I can not stop while command. Please help me.
Couldn't see too well as your code is a bit of a wall of text, but does l ever get updated in your loop? If not then if the expr...

más de 3 años hace | 0

| aceptada

Respondida
Removing a column from a Matrix product in one expression
Strange as it may seem, try this C= A * B(:, 2:end) Terser is not always better, especially when things start to become confus...

más de 3 años hace | 0

| aceptada

Respondida
How can I plot 3D graph using x,y,z data with different axis size/limit?
You say that the limits don't work - I assume you mean this doesn't work? xlim([0 30]) ylim([0 40]) zlim([0 1])

más de 3 años hace | 0

Respondida
Making a text heading to a table with numbers
%Creat table with named fields tbl=table(3,4,5,6, 'VariableNames',{'Cats', 'Dogs', 'Ants', 'Fish'}) %Add row(s) tbl{end+1,:...

más de 3 años hace | 1

Respondida
Error : Index exceeds the number of array elements
Y1 and X will be the same dimension as j1 - (n/2)+1 (26). Once your for loop counter hits 26 you will get an error since you are...

más de 3 años hace | 1

| aceptada

Respondida
Meaning of the if statement
The if statement is checking that the number of columns in x (the number two in the argument of size is specifying that the fun...

más de 3 años hace | 1

Respondida
vector with spacing (predefined)
Maybe I am missing something, but this? initial_value=-25; step_size=5; final_value=15; vector=initial_value:step_size:fin...

más de 3 años hace | 0

| aceptada

Respondida
10x10 Matrix
a=ones(10); a(2:end,2:end)=randi([0 10],9)

más de 3 años hace | 0

Respondida
How do I ensure the user inputs a minimum x value that's actually smaller than the maximum x value?
isError = 1; while isError user_input1 = input(['Enter the minimum and maximum values of x in',... '\nthe form ...

más de 3 años hace | 0

| aceptada

Respondida
How do I automate breakdown of an array into smaller arrays?
for k=1:(size(r1,1)-3) v(:,:,k)=[r1(k:k+3,:)] end All 4x3 matrices will be held in v indexable by the third dimension of v

más de 3 años hace | 0

| aceptada

Respondida
how to generate?
Consider the ASCII value for zero - the only way a computer can make sense of the subtraction is to subtract their ASCII values....

más de 3 años hace | 0

| aceptada

Respondida
Index in position 2 exceeds array bounds (must not exceed 1).
y_v is 2001x1x2 - you are trying to index the second column which does not exist. Do you mean this? clc A= [ -0.0240 -9....

más de 3 años hace | 0

| aceptada

Respondida
Code not working, something with while loop
The counter for the inner i loop never gets reset back to it's initial value, so it will only run on the first iteration of the ...

más de 3 años hace | 1

| aceptada

Respondida
Why is my code a matrix and not a double
The probable source of your error is the first two conditions in the if block - they result in E_n being a 4x1 vector since e is...

más de 3 años hace | 0

Respondida
dot in an expression
Element by element division

más de 3 años hace | 1

Respondida
Make Y-axis show percentage of values, highest value to be set as 100%.
y = [10.6, 6.4, 5.2, 5.2, 6.3, 14.3, 19.0, 22.3, 22.5, 25.9... 26.5, 25.1, 24.3, 24.6, 23.9, 23.6, 23.2, 24.6, 22.7, 23.4.....

más de 3 años hace | 0

| aceptada

Respondida
Return variables or elements with similar corresponding values
Essentially you would subtract a square matrix formed from the list of populations copied to form a square matrix and subtract ...

más de 3 años hace | 0

Respondida
how do i get this to plot a graph
You are trying to plot isolated unconnected points - they can't be joined with a line so the only way you can see them is to use...

más de 3 años hace | 0

| aceptada

Respondida
Can I fix 'Out of Memory' error by attaching an external drive?
Unfortunately a hard disk is a poor alternative to physical RAM. Whilst it is possible to get Windows to use the hard disk as vi...

más de 3 años hace | 1

| aceptada

Respondida
Extract Values from Matrix row
You can use the logical vector to index the main array i.e A(A1)

más de 3 años hace | 1

| aceptada

Respondida
Store variables from a loop to use later
The line in the k loop: Var = zeros(length(Answer),length(Answer)); This overwrites all values in Var with zeroes on every ite...

más de 3 años hace | 0

| aceptada

Respondida
How to convert this ...for loop to while loop ?
i=1; while i<=5 j=1; while j<=20 amp=i*1.2; wt=j*0.05; v(i,j)=amp*sin(wt); j=j+...

más de 3 años hace | 1

| aceptada

Respondida
How to segment one row matrix into multiple row matrix
Ultimately you can't have a matrix of the segments since they are potentially of different lengths - you could have a cell array...

más de 3 años hace | 0

Respondida
How can I store the result after each iteration in a row vector?
A quick hack would be: Ad = [1 2]; Ac = [1 2 3 4]; As=[]; for i=1:length(Ac) for j=1:length(Ad) As=[As Ad(...

más de 3 años hace | 0

| aceptada

Respondida
Plot doesn't show lines, only markers
In that case it would largely depend on your code, and how much effort you want to put into it (I assume this 'values' variable ...

más de 3 años hace | 0

Respondida
Plot doesn't show lines, only markers
Take a look at the help documentation for the plot command: https://uk.mathworks.com/help/matlab/ref/plot.html There are optio...

más de 3 años hace | 0

| aceptada

Respondida
How to build a table within an if loop without preallocation
Doubtless, you will kick yourself - but put your main table declaration outside the loop, or you'll be overwriting the old main ...

más de 3 años hace | 0

| aceptada

Respondida
Save Monte Carlo output
Change the line ExpoStart(column)=row to ExpoStart(i,column)=row And (I think) it will do what you want. There is an argumen...

más de 3 años hace | 0

| aceptada

Cargar más