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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

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

etwa 3 Jahre vor | 1

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

etwa 3 Jahre vor | 1

| akzeptiert

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

etwa 3 Jahre vor | 1

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

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

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 1

| akzeptiert

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

etwa 3 Jahre vor | 0

Beantwortet
dot in an expression
Element by element division

etwa 3 Jahre vor | 1

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 1

| akzeptiert

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

etwa 3 Jahre vor | 1

| akzeptiert

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 1

| akzeptiert

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

etwa 3 Jahre vor | 0

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

| akzeptiert

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

etwa 3 Jahre vor | 0

| akzeptiert

Mehr laden