回答済み
How to index matrices inside a loop?
Hello, You can change your code a bit like this %% Quantum Control format long clear all clc %% Variables time = -20000...

5年以上 前 | 1

| 採用済み

回答済み
Convert Column Vector to arrey matrix
Hello, You may see this function, it will help you https://www.mathworks.com/help/matlab/ref/reshape.html

5年以上 前 | 1

| 採用済み

回答済み
solve not returning two answers
Hello, Maybe you could try with another approach, for example, eq = @(y)2*log((((N-y)./(q*N)).^(N-y)).*((y./((1-q)*N)).^y)) ...

5年以上 前 | 1

| 採用済み

回答済み
Index in position 1 exceeds array bounds (must not exceed 1).
Hello, There are several approaches that you can try to eleminate the point inside the circle. Here, I can show you a solution...

5年以上 前 | 0

| 採用済み

回答済み
How can i average a 1-D array every n elements?
Hello, I think this function is exactly what you want https://www.mathworks.com/help/matlab/ref/movmean.html

5年以上 前 | 0

回答済み
Solve out a symbol
Hello, If you write solve(k,s) the solve function will solve another equation k == 0, i.e, w*sqrt(e*m/2)*sqrt(sqrt(1+(s/(...

5年以上 前 | 1

| 採用済み

回答済み
Not able to get plot
Hello, You used the linespace function with wrong parameter. Here is instruction of linespace function: linspace(X1, X2, N) ...

5年以上 前 | 1

| 採用済み

回答済み
How can I define the time steps of an x-y plot?
Hello, To get the same figure, you should refine the time step and then you should store value of X and Y with respect to t be...

5年以上 前 | 1

| 採用済み

回答済み
Counting the Same Occurance of a row string
Here is a possible solution that you can refer clear pj1 = { 'AVX', '0601' 'AVX', '0603' 'AVX', '0603' 'EPC', '0603' '...

5年以上 前 | 1

回答済み
Access multiple folders and extract specific files
Hello, If I understood you well, the code below could help you clear root_folder = 1:12; fig_number = [4 8]; for i = 1:...

5年以上 前 | 0

回答済み
How to extract specific rows from a text file?
Hello, Here is an solution that you can refer, clear FileName = 'HP1_ordered.txt'; NewFile = 'HP1_ordered_skip10.txt'; ...

5年以上 前 | 1

| 採用済み

回答済み
i wanna improve my function
Hello, As guided by @Geoff Hayes, I could give an example code here. function [res] =contain(v,u) res=true; idx = find(u ==...

5年以上 前 | 0

回答済み
Write to file inside a loop
Hello, You can refer a simple solution as follows saveb1 = []; for (your loop) your code to compute b1; ...

5年以上 前 | 1

回答済み
Calculate volume below a 3D points
Hello, There is a problem with the interpolation function which is not good to give us a smooth fuction. If you plot the "inte...

5年以上 前 | 0

回答済み
Taylor Series of e^x on point 1
Hello, At least, I found a mistake in your program. Let see the line T = symsum((F(o,1)*(x-p)^N)/factorial(N), N, 0, o); Th...

5年以上 前 | 0

回答済み
Minimization of two variables
Hello, Here is an example for your problem, which you can refer clear xiyi = [0,1; 1,3; -1 2]; x0 ...

5年以上 前 | 0

| 採用済み

回答済み
How can I get plot with smooth lines from this data?
Hello, There is an option that you can refer, a1 = smooth(a); plot(x,a1) There are many types of smooth function, you may ...

5年以上 前 | 1

回答済み
Why the increment of plot not working ?
Hello, You shoul try to put figure('Position',[392,345,441,421]); surf(Data(:,:,i)); shading interp; view(2); % couldn;t a...

5年以上 前 | 1

| 採用済み

回答済み
evaluate dynamic variables in a loop and assign each one with optimvar.
Hello, This small example may help you clear N = 3; b = cell(1,N); for i = 1:N a = sprintf('b%d',i); b{i} = ...

5年以上 前 | 1

| 採用済み

回答済み
how to specify length on subplot
Hello, You could set xlim of the first figure. More details, you should see this https://it.mathworks.com/help/matlab/ref/...

5年以上 前 | 0

| 採用済み

回答済み
Find argmin of function with unique vector
Hello, Here is an example that you can refer I find mininum of function , the initial guess is given by . The code could be ...

5年以上 前 | 0

回答済み
For loop to extract every 3rd column out of matrix and assign as variable name
Hello, Here is an example that you can refer for i = 1:24 v = genvarname(['X' num2str(i)]); eval([v '= A(:,3*i);']); end ...

5年以上 前 | 0

回答済み
Can i debug a for loop ?
Hello, In your code, you save variables "S" and "ab" with the same name for each loop. Therefore, the 'trajektorien.mat' only ...

5年以上 前 | 0

| 採用済み

回答済み
Condition for matlab if
Hello How about if you remove semi-colon in the line if g(i)+20>size(Wscat,1);

5年以上 前 | 0

回答済み
How can i fix ' Unable to perform assignment because the left and right sides have a different number of elements.' in the loop functions ?
Since "omega3" is a vector, which is not scalar and you calculate alpha3 by using omega3. So, I suggest you change "omge3" in ...

5年以上 前 | 0

回答済み
Write a function ShowPrimes(n) that will find all prime numbers between 1 and n and return them as a vector. Do this using a for loop. Hint: use isprime(x) to check whether x is a prime number. As an example, >> primes=ShowPrimes(20) primes =
Hello, The idea is that you use isprime to check is this prime or not. Then, if it is the prime, you store the value of "i" ...

5年以上 前 | 0

| 採用済み

回答済み
Find the minimum of a multi-variable function
Hello, In your code, it was not good to put the name like "fun(x,y)". Also, we do not need to declare "fx, fun, fy,.." as sym...

5年以上 前 | 0

| 採用済み

回答済み
Plotting -3|siny|
it should be like that x=-3*abs(sin(y));

5年以上 前 | 0

回答済み
Rearrange any matrix Randomly with a specific sequence
Here is an example that you can refer a = 1:20; b = randperm(4); n = length(b); for i = 1:n c(5*(i-1)+1:5*i) = a(5*(b(i)-1...

5年以上 前 | 0

| 採用済み

回答済み
How to get line number in a text file with a specific word
Hello, you could try this fileID = fopen('fruit.txt','r'); A = textscan(fileID,'%s'); fclose(fileID); n = size(A{:}); fo...

5年以上 前 | 1

さらに読み込む