This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clc | |
| caps = [1, 2, 3, 4]; % put actual capacitor numbers here (Converted to SI units ie. Ferads) | |
| inductors = [1, 2, 3, 4]; % put inductor values here (Converted to SI units ie. Henrys) | |
| targetFrequency = 1200 * 10^3; | |
| for i = 1 : length(caps) % goes through elements in caps array | |
| for j = 1 : length(inductors) % goes through all inductors | |
| % run the amplitude function (the loops will take care of every combo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % RLC circuit calculation tool | |
| % MTHE 225 | |
| % Ethan Peterson | |
| % Student #: 20105011 | |
| % June 13, 2019 | |
| % Setup | |
| clc % Clear previous output | |
| % RLC Circuit Values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| A = 0.000754, L = 0.100000, C = 0.100000 | |
| A = 0.002493, L = 0.100000, C = 0.330000 | |
| A = 0.005147, L = 0.100000, C = 0.680000 | |
| A = 0.007583, L = 0.100000, C = 1.000000 | |
| A = 0.025349, L = 0.100000, C = 3.300000 | |
| A = 0.053257, L = 0.100000, C = 6.800000 | |
| A = 0.079689, L = 0.100000, C = 10.000000 | |
| A = 0.292844, L = 0.100000, C = 33.000000 | |
| A = 0.641305, L = 0.100000, C = 68.000000 | |
| A = 0.867914, L = 0.100000, C = 100.000000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #define NUM 100 //Take 100 usernames | |
| #define MAXLEN 20 // Max username and password length | |
| // Function declarations | |
| int readDatabase(char *usrDB[], int pswrdDB[]); | |
| char *getUsername(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func timeDifference(firstHour : Int, firstMinute : Int, secondHour : Int, secondMinute : Int) -> Int { | |
| return abs(((firstHour * 60) + firstMinute) - ((secondHour * 60) + secondMinute)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // your code here | |
| func levelCost(heights : [Int], maxJump : Int) -> Int { | |
| var points = 0 | |
| for i in stride(from: 0, through: heights.count, by: 1) { | |
| if (i < heights.count - 1) { | |
| if (heights[i] == heights[i + 1]) { | |
| points += 1 | |
| } else if (heights[i] < heights[i + 1] && abs(heights[i + 1] - heights[i]) <= maxJump) { | |
| let addedPoints = 2 * (abs(heights[i + 1] - heights[i])) | |
| points += addedPoints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // your code here | |
| func verify(expression : String) -> Bool { | |
| // get all chars in an array | |
| var closeP = 0 | |
| var openP = 0 | |
| for char in expression.characters { | |
| if (char == "(") { | |
| openP += 1 | |
| } else if (char == ")") { | |
| closeP += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var input : String = "This:-(is str:-(:-(ange te:-)xt." | |
| var sad = 0 | |
| var happy = 0 | |
| // convert input to char array | |
| var inputChars = [Character]() | |
| for char in input.characters { | |
| inputChars.append(char) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| /* | |
| MAKING A PLAN | |
| A common problem solving model is known as input-process-output. | |
| 1. What are the possible inputs I can expect to receive? | |
| 2. How should each type of input be processed? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let alphabet : [Character] = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] | |
| let consonant : [Character] = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"] | |
| let vowels : [Character] = ["a", "e", "i", "o", "u"] | |
| let input : String = "joy" | |
| var output : String = "" | |
| func isCons(letter : Character) -> Bool { |
NewerOlder