Risolto


Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

circa 4 anni fa

Risolto


Counting Money
Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99. E...

circa 4 anni fa

Risposto
problem to write a condition for 'if'
Try the following code: A = {[1,2,3,4], [1,2,3,6], [1,2,3,8], [1,2,6,7,8], [1,6,8], [2,3,4,7], [3,4,6], [3,4,6,7], [3,4,6,7,8],...

circa 4 anni fa | 0

| accettato

Risposto
control system bode plot
Try this: alpha=1;Wcr=10; syms w Mag(w)=piecewise(w<Wcr,20,w>=Wcr,-26.144+20*alpha*log(w)); w=logspace(-1,3,1000); semilogx...

circa 4 anni fa | 0

| accettato

Risolto


Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

circa 4 anni fa

Risolto


Weighted average
Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

circa 4 anni fa

Risolto


radius of a spherical planet
You just measured its surface area, that is the input.

circa 4 anni fa

Risolto


Is this triangle right-angled?
Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

circa 4 anni fa

Risolto


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

circa 4 anni fa

Risolto


Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....

circa 4 anni fa

Risolto


Find the alphabetic word product
If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

circa 4 anni fa

Risolto


Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

circa 4 anni fa

Risolto


Find the index of elements in a string vector
In the vector of v, find the index of elements specified by a. v = ["Lion","Koara","Elephant","Snake","Dog","Cat","Camel"]; ...

circa 4 anni fa

Risposto
How can I set linewidth directly in bode command?
You can try semilogx. See the following code: sys=tf(4,[1 0.5 4]); [mag,phase,wout] = bode(sys); Mag=20*log10(mag(:));Phase=p...

circa 4 anni fa | 1

Risposto
How to create a set of impulse values in a given set of timepoints in simulink
See the attached model. I run a simulation for 10 seconds and I create three impulses which appear at t=1, 3 and 6 respectively ...

circa 4 anni fa | 0

| accettato

Risposto
How to create initialize block on SIMULINK model corresponding with M-file
You can use Callback Function property of your Simulink model. You can find it in File->Model Properties->Callback Functions. He...

circa 4 anni fa | 0

Risposto
How can I sample n elements from each column of a matrix?
Following approach can be used(using for loop): n=2; for i=1:size(A,2) y(:,i)=randsample(A(:,i),n); end y

circa 4 anni fa | 0

Risposto
How to swap columns of a matrix??
Simple approach(Consider matrix A): A(:,[1 2 8 9])=A(:,[8 9 1 2])

circa 4 anni fa | 1

| accettato

Risposto
Solving trigonometric equations in MATLAB
Try the following code. It should help you: r1=1;r2=2;r3=3;r4=4;r5=5;%random values x1=100:1:126; syms x2 x3 for i=1:numel(x...

circa 4 anni fa | 0

| accettato

Risposto
why matlab always show my equation as matrix dimension
Try this: y = (668.061./x)*[-39-exp(-0.1468*x)]

circa 4 anni fa | 0

Risposto
Calculating a new variable from a symbolic equation
You already defined values for Q_full and Q. You do not need to define them as symbolic variables later. This will not work. Try...

circa 4 anni fa | 0

| accettato

Risposto
finding overlapping and non-overlapping values in matrix
Try the following code: A=[3 16 4 16;3 21 4 21;3 29 3 29;17 27 18 29;25 72 26 72;61 70 61 70;62 63 62 63]; Un=0; for i=1:size...

circa 4 anni fa | 0

| accettato

Risposto
Matlab function for cumulative power
Try the following code. By changing r and n values, you can see the corresponding results. r=9;n=4; A=zeros(n+1,n+1); for i=1...

circa 4 anni fa | 2

| accettato

Risposto
PID controller block in simulink
This PID is in ideal form. In PID block in Simulink, you can set the PID to be in ideal form and enter the parameters. See the a...

circa 4 anni fa | 0

Risposto
Ho do i convert this number to an integer?
Try vpasolve: w=1150;di=32.59;do=23.44; sol=vpasolve((w-(2.*90.*sind(b))).^2==(w-(90.*sind(b+di))-(90.*sind(b-do))).^2+((90.*c...

circa 4 anni fa | 1

| accettato

Risposto
please help me check the error
You forgot to put multiplication operator. Try this: function A=odd_rms(n) A=sqrt(mean((1:2:2*n-1).^2)); end

circa 4 anni fa | 0

| accettato

Risposto
How to plug in one value a time from a matrix into a function (WaitSecs)
It should look something like this: for k=1:numel(A) WaitSecs(A(k)) end . . .

circa 4 anni fa | 0

| accettato

Risposto
How can I resolve this?
Following code solves the problem. The command t(0)==0 does not make any sense since t is independent variable. Also, you used d...

circa 4 anni fa | 0

| accettato

Risposto
How to simulate simulink model in a given set of time-points only?
Yes, it is possible. Consider the attached Simulink model which contains a ramp block and its slope parameter is set as 5. Its s...

circa 4 anni fa | 0

Carica altro