답변 있음
How to make my code more concise and efficient ?
I suggest using cell arrays. See documentation here: https://www.mathworks.com/help/matlab/ref/cell.html Replace "_cty1" with {...

대략 5년 전 | 0

| 수락됨

답변 있음
error in plotting clipped sinewave
Your problem is that y is not a vector. In the case of your posted code, y will be the value that it is set to on the last pass...

대략 5년 전 | 1

| 수락됨

답변 있음
code is not 'return'-ing
return does not mean 'restart'. return in the context of a script actually means 'abort' or 'return to the command line and sto...

대략 5년 전 | 0

| 수락됨

답변 있음
Create x and y vectors?
Try this: delta = 2; % dx, dy increment N = 10; % desired number of points x = 1:delta:delta*N; y = 1:delta:delta*N'; % tran...

5년 초과 전 | 0

| 수락됨

답변 있음
How to use a Loop to repeat two equations using the previous answers as the new variables.
This shows how to do the iteration using indexing and a loop instead of typing out each iteration manually: I'm not sure that t...

5년 초과 전 | 0

| 수락됨

문제를 풀었습니다


Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

5년 초과 전

답변 있음
How can one extract a column based on a value of another column?
>> A = [ 0 1; 1 0; 0 2]; >> A_0 = A(A(:,1)==0,2) A_0 = 1 2 >> A_1 = A(A(:,1)==1,2) A_1 = 0

5년 초과 전 | 0

답변 있음
How to reduce decimal point in .dat file?
For your two alternative ways of saving this data into a text file, try the following two options. Please read the documentatio...

5년 초과 전 | 0

| 수락됨

답변 있음
Hex to binary character array
This string is way too long to be converted to a decimal (or binary) number directly. It is actually 100 hex digits long (not 1...

5년 초과 전 | 1

| 수락됨

답변 있음
using fget1 to read text file. Need help sorting data
The link that Walter provided looks promising. If you wish to pursue the processing on your own, here is a script that will rea...

5년 초과 전 | 1

| 수락됨

답변 있음
What is wrong with this code?
If you are trying to plot the step and impulse responses of your transfer function you need to call step() and impulse() as func...

5년 초과 전 | 0

답변 있음
How to have a string change based on user input
I've not tried accessing this data source or running your code, but I'm pretty sure that you need to change the following lines ...

5년 초과 전 | 1

| 수락됨

답변 있음
What goes before this?
You can change your 'Stuff =' line to the following: Stuff = sprintf('%s %s is the %d day of the year.', Month,Date,N); Or, yo...

5년 초과 전 | 0

| 수락됨

답변 있음
Changing amount of decimals in between loops
Just index into the vector that you created that specifies the number of places to which you wish to round for that iteration in...

5년 초과 전 | 0

답변 있음
How can I scope using degrees insted of seconds?
The Simulink Scope block always uses simulation time as the x axis. If you wish to plot two simulation signals against each oth...

5년 초과 전 | 1

답변 있음
"Colon operands must be all the same type, or mixed with real scalar doubles" error I'm trying to run excel file into Matlab function
Well there are several things wrong with this code. You can't use size() to extract things from an array. Replace frq= size(Si...

거의 6년 전 | 0

답변 있음
How to plot phase plane only using trajectory equation?
Try something like this: c1 = 1; % replace with your desired constants c2 = -1; t=linspace(0, 10, 500); % adjust for your ...

거의 6년 전 | 0

답변 있음
Sum the digits of a number?
I know it sounds too easy to be true but this manipulation is actually the same as modulo 9. No loops or string conversions need...

거의 6년 전 | 3

답변 있음
How to find a unexpected high value and turn it to zero?
Here is a way to do this without a loop (using logical indexing) A = [2 3 4 2;5 6 7 3;8 9 0 6; 5 6 1 80;2 3 8 5;3 5 13 4] idx ...

거의 6년 전 | 0

| 수락됨

답변 있음
How to block out code in Live Script
%{ a = 1; b = 2; %} c = 3;

거의 6년 전 | 0

| 수락됨

답변 있음
How to include a vertical line at the sample when instant of landing
When I run your code, I don't get the error you cite on line 54. That seems to work fine. The only issue I found was when dete...

거의 6년 전 | 0

답변 있음
I used to be able to see "Command Window" and "Command History" at the same time, now I must switch back and forth?
If you bring the Command History to the top you can grab the top edge of that window (where the title 'Command History' is) and ...

거의 6년 전 | 0

답변 있음
how to print a table
This should be close to what you want. However, I have used the logical not, and, and or functions which appear to be diffferen...

거의 6년 전 | 0

| 수락됨

답변 있음
Run a code for 100 years
I don't think the results are going to be very interesting but you could do what you are asking as follows: ro=1.49e11; ...

거의 6년 전 | 0

| 수락됨

답변 있음
Using Inequality in a For loop
Walter has correctly shown how to express mutiple inequality conditions in Matlab (you must include the & (and) operator). Howe...

거의 6년 전 | 1

| 수락됨

답변 있음
how to fill between 2 graphs
What do you mean by "fill the gap"? Do you want to connect the start and end points so that this becomes a closed curve? If so...

거의 6년 전 | 0

| 수락됨

답변 있음
Store matrices under different variable names within a loop?
Make A a 4x4x4 three-dimensional matrix instead of creating multiple 4x4 matrices: mat = randi([0, 9], [4,16]) A = zeros(4,4,4...

거의 6년 전 | 2

| 수락됨

답변 있음
Fill command issue for time series
Based on your sample data, you need to make a simple change to your code. Since your vectors are columns, you need to concatena...

거의 6년 전 | 1

| 수락됨

답변 있음
Creating an array with exprnd numbers
Try this: A = zeros(100, 2); mu = 5; % or whatever you want for the mean of the distribution A(:,1) = exprnd(mu, size(A(:,1))...

거의 6년 전 | 0

| 수락됨

더 보기