Recent content by physizl

  1. P

    How do i replicate power function? in MATLAB

    Homework Statement need to do a power function of any number to any power WITHOUT using the power key aka i need to replicate the power function using only loops and multiplication for example, compute 5 to the third power by doing 5*5*5 not 5^3 but i don't know how to tell MATLAB...
  2. P

    How Can I Select a Random Subset of Cards in MATLAB for Blackjack?

    thanks that helps so now i have: h1 = round(12*rand(1,2))+1; disp(['Dealer deals you: ' , num2str(h1) ] ) d1 = input('hit or pass? '); for hit h2 = round(12*rand(1))+1; % user's new hand h12 = [h1 h2]; disp(['Dealer deals... you get: ' , num2str(h12) ]) end i have...
  3. P

    How Can I Select a Random Subset of Cards in MATLAB for Blackjack?

    Homework Statement write a code for a user to play a game of blackjack The Attempt at a Solution I have deck = ['AH';'2H';'3H';'4H';'5H';'6H';'7H';'8H';'9H';'TH';'JH';'QH';'KH'; 'AS';'2S';'3S';'4S';'5S';'6S';'7S';'8S';'9S';'TS';'JS';'QS';'KS'...
  4. P

    MATLAB Why Does My MATLAB Function Only Return One Value Instead of Two?

    been looking online and messing around with different codes for almost a couple hours now... but my assignment is: " Define a function named projectile_position that computes and returns [x,y] where x is the distance a projectile has traveled along the ground from its position at time 0...
  5. P

    Calculating Electric Field at Lead-199 Nucleus with Gauss's Law

    nevermind i figured how to do it! i used.. E = kQ/(r^2) Q = (# protons)(elementary charge) r = [(# lead)^(1/3)](radius proton) plugged Q and r back in E and came out with the correct answer
  6. P

    Calculating Electric Field at Lead-199 Nucleus with Gauss's Law

    Q = enclosed charge? p = charge density & V = volume, so the units are just C when you multiply pV for r, i set whatever the volume is and i set it to equal (4/3)pi(R^3) and solved for R
  7. P

    Calculating Electric Field at Lead-199 Nucleus with Gauss's Law

    Homework Statement Determine the magnitude of the electric field at the surface of a lead-199 nucleus, which contains 82 protons and 117 neutrons. Assume the lead nucleus has a volume 199 times that of one proton and consider a proton to be a sphere of radius 1.20 10-15 m. Homework...
Back
Top